Skip to content

Tag: pygame

Pygame doesn’t let me use float for rect.move, but I need it

I’ve recently recreated a version of Lunar Lander (you know, the old retro game) in Python 3 and Pygame: my lander moves (̀̀̀rect.move) each frame along the y axis because of gravity. Problem: Until I hit 1 m/s, the y value added to rect.move is a float under 1: I must use int() to round it up, as pygam…

Running two files on a single project on PyCharm

I am currently developing a IoT sensor value simulator using the PyCharm IDE (along with pygame). Essentially, I am trying to produce/send data to Microsoft Azure IoT platform while there is a GUI available for users, in which they can see the temperatures of each sensor, change the sensor outputs, etc. Since…

Python3 PyGame how to move an image?

I tried to use .blit but an issue occurs, here is a screenshot to explain my problem furthermore: The image appears to be smudged across the screen following my mouse code: Answer Fix the indentation in your given code, it puts all the important stuff outside the while loop. You can also add a function that r…

ValueError: is not in list

I trying to make spaceship game from using pygame. Just simple game what warship shoot bullet and collide enemies. But when I play my game, after 6 or 7 collisions I get below error. creating bullet class creating enemy class and defining collide def calling collide definition in for enemy loop Then take this…

Problem to install pygame on ubuntu 20.04LTS

I am on Ubuntu 20.04LTS, and I try to install pygame (for python) for a school project. But when I try this: I received an error: Can you help me, please? Answer Try installing it with instead. The error you are getting is because you are missing the Pygame dependencies, which apt should install for you. As a…