Questions Tagged [Pygame]
Ask Question Pygame Is a Set of Python Modules Designed for Writing Video Games. Use This Tag Only If You Are Using the Pygame Library and Not If You Have a...
Pygame is a set of Python modules designed for writing video games. Use this tag only if you are using the Pygame library and not if you have a question about programming a game in Python in general.
Must Read
18,833
questions
0
votes
1
answer
16
views
How to fill a specific area with a certain color?
So I want to figure out to only fill the bottom part of my background green. However, since I just started Pygame I don't actually know what code there is for filling in backgrounds except for screen....
0
votes
0
answers
11
views
Pygame zooming screen
im writing a game right now with 32x32 textures, i have a problem because my screen window is too small, is there any solution? Can i "zoom" my whole game?
Now it looks like this and exactly ...
0
votes
0
answers
8
views
Pygame delete non sprite objects
So Im trying to make an upward scrolling platformer, and I need a way to delete the score counter and hide the death screen when a player dies and restarts. However, those objects aren't sprites. Is ...
-1
votes
0
answers
16
views
How can i move the character up and down? [duplicate]
enter image description here
from sys import exit
pygame.init()
screen = pygame.display.set_mode((500,500))
name = pygame.display.set_caption('witchie')
icon = pygame.image.load('C:\\Users\\lenovo\\...
-2
votes
1
answer
16
views
Conveyor belt kinematics Python
I'm trying to create a simulation for a conveyor belt with objects on it, to see how the behaviour would be. I am playing around but struggling with the functionality of the conveyor belt. Right now, ...
1
vote
1
answer
27
views
Create trails of paticles for the bullets
I'm creating a space shooting game in which a spaceship will fire out bullets every time the user clicks the left mouse and since I want the bullets to be a bit fancier I want them to have a trail of ...
-4
votes
0
answers
31
views
Can someone please explain this, please? [closed]
I'm using the pygame import in python, and it keeps telling me that I added an unneeded argument.
Here is the code for the rectangle class:
class Rectangle:
x = 0
y = 0
width = 60
...
2
votes
1
answer
54
views
Speed is reduced substantially when writing to serial port
Using pygame to read info from controller, but when I add arduinoData.write(str.encode(ALL_DATA)) it reduces the speed a lot, what can I do?
The line is added almost at the bottom. Is it the placement ...
0
votes
0
answers
10
views
button is unresponsive and does not exit when clicked in pygame, is my code incorrect? all it does is display the button [duplicate]
if quit_button.draw(screen):
pygame.quit()
exit()
in my window, the button is displayed but when clicked it doesn't close the window, did I do it wrong?
0
votes
0
answers
14
views
when i run the code using pygame module it's terminal closes I use VS Code i cant understand the problem [duplicate]
The problem I am facing is in the image.
I don't understand why is I not working?
import pygame
pygame.init()
dis=pygame.display.set_mode((400,300))
pygame.display.update()
pygame.quit(...
2
votes
1
answer
33
views
pygame keeps keys pressed even after a new start of the game
I have a strange behavior with when using pygame.
[...]
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
[...]
while running:
[...]
dt = (new_time - start_time).total_seconds()
...
0
votes
0
answers
33
views
Failed to execute script error after successful execution exe
I am trying to create an exe file for my pygame game with pyinstaller. The command I am using is pyinstaller --noconsole 2d_minecraft.py. It creates the dist folder successfully.
I am getting this ...
0
votes
1
answer
23
views
Running into errors with pygame.image.fromstring() arguments
I would like to be able to display a PIL image object created from a numpy array of 8 bit integers (essentially just a grayscale image) using pygame, but have been running into several errors in the ...
0
votes
1
answer
29
views
Character doesn't show up and I also get this message: TypeError: invalid destination position for blit
Console:
pygame 2.1.2 (SDL 2.0.16, Python 3.8.12)
Hello from the pygame community.
Traceback (most recent call last):
File "main.py", line 96, in <...
1
vote
1
answer
31
views
Collision betwen two same sprites but with diffrerent reactions
I have a small problem with my code. The goal is to simulate traffic (two lanes merging into one). I am close to finishing but i have the problem that when a car hits a car of the same Group the whole ...