Questions tagged [pygame]

A game development library based on the Python programming language. It wraps SDL for easy use alongside Python.

Filter by
Sorted by
Tagged with
1 vote
1 answer
120 views

Reflect Code Changes in a Current Run

I am developing a game in Python using Pygame. I am wondering whether there is a way to make changes to a currently running game by modifying the script (like Notch does in this clip). For example, ...
DyingIsFun's user avatar
  • 1,307
1 vote
2 answers
14k views

Pygame Collide Rect

Currently making a maze game. Maze is drawn, everything is drawn with pygame.draw.rect. I have tried using pygame.coliderect() to check for colisions, but it isn't working. The current error message ...
N.Huggett's user avatar
1 vote
2 answers
740 views

How to implement the missile trajectories in the classic missile command game - pygame

I am doing a clone of the classic arcade game missile command, i am curious about how to implement the trajectories of the missiles. I have a solution that looks pretty similar to the original game, ...
angvillar's user avatar
  • 111
1 vote
1 answer
7k views

How to integrate Tiled maps and collision detection with pygame?

I have been using pygame to make a simple rpg pokemon style game. To create maps I have used the Tiled map editor and then loading them into pygame using pytmx. I have heard that you can add object ...
James's user avatar
  • 183
1 vote
1 answer
571 views

What Is A Good Way To Make A Self Updating Game? (Python) [closed]

I've been making games and I have always had a problem if I wanted to sell a game. People would have to re-buy games to get the updated version. Does anyone have any ideas on how to make a self ...
user3339168's user avatar
1 vote
2 answers
3k views

Pygame wall collision is acting very odd

I've been playing around with python for a while, but I only did basic functional programming. Lately, I've been teaching myself about classes. I've been using pygame (instead of tk, because let's ...
Netanel's user avatar
  • 11
1 vote
2 answers
1k views

Sprite erasing text in Pygame

I'm making a Pong clone in which the user can press the 'p' button to pause/unpause the game. When the user presses the 'p' button the word 'PAUSE' is drawn to the screen and when he presses again the ...
bzrr's user avatar
  • 263
1 vote
2 answers
13k views

Installing the right version of PyGame

I've been trying to install PyGame for Python, and can't seem to get Python to recognize that it's there. I use Python 3.3, and have a 64-bit Windows computer, but that's really all I know. The ...
user2403876's user avatar
1 vote
1 answer
1k views

Pygame - Change sprite collision Rect

I'm making a platformer in Pygame. One of the sprites I'm using is a flag, and I want to detect if the player collides with the flagpole (just like in Super Mario Bros). The problem is that the image ...
cangrejo's user avatar
  • 131
1 vote
1 answer
2k views

Embedding Pygame to C++ [closed]

If embedding Pygame to C++ to have a game be an executable, is there any extra process I would have to use in order to use Pygame functions when embedding into C++? As opposed to just writing ...
0X1A's user avatar
  • 143
1 vote
1 answer
153 views

Drawing over objects occasionally leaving relics behind

I'm drawing a large number of bouncing shapes similar to an old 1990s screensaver. I'm just doing this to study (but not hopework) For some reason my object clearing (simply blitting a black shape ...
Ceryn's user avatar
  • 35
1 vote
1 answer
690 views

Pygame 2D : rotation around center not working properly

here is the code I use to rotate an image around its center: ...
Salem's user avatar
  • 226
1 vote
1 answer
1k views

Can't check collision between a mask and a rect in pygame

I'm new to using masks in Pygame and I'm having trouble with them. I have already learned how to check collisions between two masks but I'm wondering about an effective way to check collisions between ...
Salem's user avatar
  • 226
1 vote
2 answers
5k views

How do you rotate a sprite in pygame?

I am making a game in Pygame and I want it so every time the sprite jumps it rotates mid-air and lands on its side. A lot like Geometry Dash jumping if you have ever played that. I have some code but ...
Pixeled's user avatar
  • 111
1 vote
1 answer
832 views

How to display the counter in pygame.time.set_timer?

in pygame, we use pygame.time.set_timer() to repeatedly create an event. This function takes 2 arguments : the event type and the delay time after which the event ...
Salem's user avatar
  • 226
1 vote
1 answer
113 views

The gameloop is stucking the window

I tried to display a player image in a 800x600 window using PyGame but when I try it, the window just gets stuck (immovable with mouse drag, minimize,maximize and close button is stuck and not ...
user avatar
1 vote
1 answer
759 views

delta_time with discrete movement

I have a basic snake game movement system with Pygame: ...
Scene's user avatar
  • 123
1 vote
2 answers
60 views

Rotating Cannon's Mouth Toward Player

I am trying to make my cannon mouth rotate towards player, but the rotation is messed up and up I don't know how to fix it. ...
lilly mosling's user avatar
1 vote
1 answer
637 views

Implementing melee combat in pygame?

I've gone about 2 ways for implementing melee attacks however, bboth have major flaws, hoping someone has a simpler answer. Method 1: Creating a "projectile" that's using an image, then ...
Master Chef's user avatar
1 vote
4 answers
2k views

Pygame polygon click detection

Here is my problem: I am creating a game and I have a board made out of polygons (hexagons). I want to be able to click on the different tiles but I can't find a simple method. I understood how to ...
Cassayre Valentin's user avatar
1 vote
1 answer
224 views

Moving Rect with KEYDOWN

I tried to move my obstacle with the event type KEYDOWN, but it seems it is not working. This is my code. ...
AKKI's user avatar
  • 11
1 vote
1 answer
4k views

Why is my program "not responding" when I run it?

I'm trying to learn to code with python and while using pygame, I came across this: every time I run the window it says "not responding". Specifically, it happens when I click to drag the window; the ...
Elliot's user avatar
  • 11
1 vote
1 answer
373 views

Problem with diagonal collision response using PyGame

So I have been having this problem for the last few days and it has me really frustrated. What I am trying to do is resolve collisions with custom hitboxes in PyGame and it looks something like this: ...
Tripti's user avatar
  • 21
1 vote
1 answer
156 views

Find the co-ordinates of collided objects in Python

I have a group containing my aliens and another containing the bullets I have fired. When I detect their collisions, I want to pull the alien's x-y co-ordinates during it's deletion so I can put an ...
Andrew's user avatar
  • 121
1 vote
1 answer
335 views

*Python* Class - self.x = self - What does it mean to set it to self?

I have this class for my game that is a scene manager. I followed a tutorial and I am confused on why the self.scene.manager is equal to self ...
user avatar
1 vote
2 answers
504 views

Pygame - Maze collisions problem

I am a beginner in Python and Pygame and I have a problem with my game in pygame. I have Maze class and Player class but I can't do proper collisions. I reached the moment where I have no idea why my ...
Rosalie Black's user avatar
1 vote
2 answers
8k views

"Video system not initialized" error

I always get the error message "video system not initialized" I don't get where I went wrong with the code below: ...
Andrea Lyn Latoza's user avatar
1 vote
1 answer
2k views

How to convert coordinates between world coordinates and screen coordinates

I am using a tilemap in which I have square tiles. Knowing that, the size of the screen and the player position(in world coordinates) how I convert between this systems? Is there any formula? EDIT: ...
Simple coder's user avatar
1 vote
1 answer
261 views

Drawing each sprite at different location

I can draw multiple sprites but they are all on top of each other at (0,0). How would I make each sprite appear after one another in a row? My Rect class and Draw function: ...
GaaraOfTheSand's user avatar
1 vote
1 answer
170 views

Getting event types in Pygame

I want to have the type of an event from the event queue to decide certain actions (i.e. if it is a joystick event or a keyboard one), but the dir of events is an ...
user avatar
1 vote
1 answer
9k views

How to resize a surface in Pygame?

How can I resize a Surface object in Pygame? Is there a way to bind a surface object into a Rect object, so that resizing the ...
user avatar
1 vote
1 answer
1k views

How to Create a Perfect Dash (Quick Movement) in Pygame

I am trying to create 2d side scrolling platform similar to Megaman. Here is the progress so far: Red box is the spriteholder while blue box is the hitbox of the character. The sprite I use is random ...
Tangtaizong's user avatar
1 vote
1 answer
923 views

How can I add 3D animation to my Pygame window?

I've developed a quiz game using Pygame but now I'm being asked to implement a 3D animation element (a game show host) to the game. I used Pygame as I was told it would be an easy enough language to ...
João Oliveira's user avatar
1 vote
1 answer
856 views

In pygame, is there no graphicsContext.translate() method?

I am new to pygame. I was searching on the internet and the pygame documentation for the functions which can translate, rotate, scale the entire graphics Context, but I couldn't find them. I know that ...
anonymous's user avatar
  • 514
1 vote
1 answer
191 views

Can somebody explain this behavior in pygame?

I have an image that I'm rotating and moving And when the rotation angle is negative the image moves as expected. But when the angle is positive it moves it's origing point to the left Can anybody ...
Mntfr's user avatar
  • 123
1 vote
1 answer
3k views

pygame KEYUP KEYDOWN events only once per frame?

I've been playing around with pygame, and I ran into a bit of an odd issue with input on the pygame event queue. Consider the following test code: ...
user avatar
1 vote
1 answer
68 views

Why is the position of this image changing?

I have a python script to simulate a wrench moving, I have calculated it's origins position in x and y as a function of time, the problem is when I try to rotate the image, my code moves the image out ...
Mntfr's user avatar
  • 123
1 vote
1 answer
71 views

Tile based game. Fixing surface issue for attack

So far I've loaded the images and can move the sprite around. When I hit the spacebar to cycle through the attack sprites within the attack_front list. The image ...
crushedhat's user avatar
1 vote
1 answer
2k views

Handling Events & User Event Limits In Pygame

I am trying to make a vertical shoot em up using Python and Pygame. In order to handle timing, such as when certain enemies come out and other stage events, I've been using ...
azurepancake's user avatar
1 vote
1 answer
715 views

Chaining Melee Attacks

I am working on an action platformer using Pygame. My player sprite has three melee attacks. Let's call them SLASH_1, SLASH_2, and SLASH_3. Each of these attacks has, let's say, 2 animation frames, ...
DyingIsFun's user avatar
  • 1,307
1 vote
1 answer
204 views

Visual Glitch When Drawing Rects

I have the following code: ...
MustacheMoses's user avatar
1 vote
1 answer
9k views

Games developed in Python with Pygame lags too much; how can I improve the framerate?

I'm currently working on a very simple RPG game but when I try to load all the tile images for the background, the game lags to the point it freezes (framerate drops to 0 or will just crash). The ...
conq_rp's user avatar
  • 11
1 vote
2 answers
2k views

Using sprites in pygame without classes and objects

Relevant information I'm in a grade 11 computer science class that uses Python & Pygame. We're aloud to use sprites and images though we're never taught it, just drawing graphics like squares and ...
Kyle's user avatar
  • 69
1 vote
1 answer
8k views

How to display text for 3 seconds in pygame

I am trying to print "You Crashed" when car hits wall(or blocks) for 3 seconds and then again start game loop. I tried using time.sleep(3) but it's not working. ...
Freddy's user avatar
  • 111
1 vote
1 answer
3k views

What is Surface.set_colorkey() in Pygame?

In pygame, what does Surface.set_colorkey() do? Explain it in a very easy way please. Also, what exactly does it do? I heard it makes parts that are the same color ...
TJRelytS's user avatar
1 vote
1 answer
4k views

How can I take a screenshot of a certain part of the screen in PyGame?

I need to for my pixel art tool that I'm making to help myself make games.
user3339168's user avatar
1 vote
1 answer
89 views

Text blits to screen at wrong y-coordinate

I have a program that is meant to scroll numbers/letters down the screen, like in the movie "The Matrix". When one of the columns reaches a letter in the user's name (obtained using user input), it ...
Nate.Olson's user avatar
1 vote
1 answer
1k views

How do I update individual sprites within a spritegroup in pygame?

I have a for loop that takes values from a text file, and then creates and adds a bunch of sprites to a group platformlist_list. The for loop will continue until every line of the text file is read. <...
init fail's user avatar
  • 111
1 vote
1 answer
2k views

How to use collision masks and overlap_area in pygame?

So, I've been prototyping a game, and I've been using sprite collision, and it's not cutting it any more. I read up on the documentation about masks and overlap area: https://www.pygame.org/docs/ref/...
digiholic's user avatar
  • 141
1 vote
2 answers
5k views

Getting a color value from a coord

My goal is to get a RGB value of a pixel based of off a X,Y coordinate. I have been working on AIs for a small project attempting to make a bot that can pass through a maze. I want to get the pixel ...
Ryan's user avatar
  • 111

1 2 3
4
5
10