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 question about programming a game in Python in general.

18,833 questions

0votes1answer16views

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.... user avatar Blu

  • 13
0votes0answers11views

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 ... user avatar Yoshow2137

  • 31
0votes0answers8views

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 ... user avatar DatDerpyDude81

  • 11
-1votes0answers16views

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\\... user avatar Precious Candy

  • 1
-2votes1answer16views

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, ... user avatar Ruben Vreugdenhil

  • 1
1vote1answer27views

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 ... user avatar no DHC

  • 11
-4votes0answers31views

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 ... user avatar KjAnimates

  • 1
2votes1answer54views

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 ... user avatar Some Student

  • 43
0votes0answers10views

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? user avatar rnsleep

  • 9
0votes0answers14views

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(... user avatar Rudransh Joshi

  • 1
2votes1answer33views

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() ... user avatar ZenCoding

  • 95
0votes0answers33views

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 ... user avatar coder

  • 65
0votes1answer23views

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 ... user avatar JBowers

  • 23
0votes1answer29views

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 <... user avatar b.ferris

  • 3
1vote1answer31views

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 ... user avatar Jrmnp

  • 25

153050per page

1 2 3 4 51256