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
0
votes
0answers
10 views

I am coding a arcade game for my class [closed]

I am trying to figure out how to do a melee attack event listener button in python for a arcade machine. I need some help trying to figure it out Can Someone please help me?
0
votes
0answers
20 views

How to make gravity in pygame?

I'm not sure why my gravity isn't working... Can pleas anyone help?? Here my code: ...
0
votes
0answers
9 views

How to make my sprite jump in pygame?

I wonder how to make a sprite jump in pygame! Can anybody explain if possible? Thank you!
0
votes
0answers
23 views

Why don't my keypresses work in Pygame?

I don't know why my attempt to read keypresses in Pygame is not working. ...
1
vote
1answer
24 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 ...
0
votes
1answer
12 views

Full screen to windowed screen workaround causing segmentation fault in pygame

I'm having an issue that causes the window bar to appear above the screen when jumping between full-screen and windowed mode. Did some googling on the issue and it turns out it's actually a pygame bug,...
0
votes
1answer
22 views

Pygame bullet firerate not working sometimes

i have made this bullet class but i have a problem with the firerate. Sometimes i'm not able to shoot even when the little delay (700ms) between the two shots has ended. I guess it's due to the ...
0
votes
1answer
37 views

Image color being changed when pygame blitting to screen

I'm working on my first game, and I decided to add some trees that twinkle to the game. For some reason when the image is blitted to the screen using pygames blit ...
0
votes
0answers
36 views

How to make a z-depth buffer with pygame?

I am making a 3d renderer with python and so far am sorting the triangles which I want to replace with a z-depth buffer. The thing is, I don't know how to make a z-depth buffer in pygame. I still want ...
0
votes
0answers
24 views

How would you have a range of movement within a class in pygame?

I have blitted 4 zombies to the screen in pygame. First, the zombies will wander in a specific region (let us say a 10 x 10 area). And when the player enters any one of the zombie's areas, the zombie ...
0
votes
1answer
29 views

How do I click on specific text in an array of text?

I am trying to click on a specific word in an array but I can't think of how. This is what I have: ...
0
votes
0answers
18 views

Pygame Platform & Player collisions

I am trying to create a platform game where a player jumps between platforms horizontally (using a projectile curve). Currently, I have a class that blits platforms and a background, as well as the ...
0
votes
0answers
18 views

Having Problems in PyGame with Mouse Cursor and Sprite Collision

I know something is not right but I'm just starting out and hit a wall. Basically, I just want to MouseClick on a Sprite and make something happen. The mouse clicking itself works, the sprite ...
0
votes
0answers
24 views

How can I upload a pygame that I made on a website? [duplicate]

I'm a beginner programmer and I want to know how can you upload your pygame on websites like coolmathgames or any game websites, do you upload your code after you get a deal with them? do you save it ...
1
vote
1answer
57 views

player teleporting into other levels

So I basically want to load another map once the player collides with a object, specifically a "Portal" in my game. Which is really making the player move onto other levels. I don't want to ...
1
vote
1answer
109 views

How can I publish a Python game on itch.io as html?

I'm making a game with Python, using Pygame. I want to publish my game on itch.io so that it's playable in the browser. Is there a way to do this? If so, how?
0
votes
0answers
29 views

Where to store polygons and polygon animation?

I thought about making something with ApeOut graphics long before it came out and its release motivated me to try - I'm having tons of fun but I stumbled upon a pickle. I can imagine storing polygons ...
0
votes
0answers
43 views

How can I change the background color of the image?

I'm trying to change my background image color, but somehow it doesn't work. I have provided my code below and hope you will be able to tell me how I should do this, and why my code didn't work. ...
0
votes
0answers
32 views

diagonal movement to a enemy in pygame

I spent a long time trying to make the diagonal movement in the form of code but I don't know how to write it. the code I have so far is almost complete but it is missing the pixelart that I will add ...
0
votes
0answers
47 views

How to make a sprite face the player sprite (pygame 2d)

Basically I have a sprite and I want its front/face to face the player sprite. All the sprites are rectangles/squares and use .get_rect(). I have a base class for ...
0
votes
0answers
22 views

Dashing mechanic in top down projectile dodging game in pygame

im making a simple third person top down game where you dodge projectiles than fly in from either side of the screen, its a simple high score game where the longer you avoid being hit, the better your ...
0
votes
0answers
18 views

Sprite walk animation blurring when sprite image moves too quickly

I didn't see any other questions like this that had an answer so I thought I'd ask in hopes this helps someone else too. I have a game I'm in the beginning stages of working on, and I've gotten to the ...
0
votes
1answer
19 views

Player not moving camera to the other side of the screen when hitting the screen edge

I'm working on a game where I want the player to appear on the other side of the screen when they get to the edge of the screen, essentially mimicking the background moving. When the player gets to ...
0
votes
0answers
14 views

PYGAME - Sprite movement seize to function when entire X and Y span is reviewed

I've created an sprite class that has a detection radius checking if the player enters the zone. If yes, the sprite moves towards the player. It works perfectly fine when the sprite checks for three ...
0
votes
1answer
42 views

Rendering tiles at a larger size for a detailed look

I'm trying to make my 32-bit tiled map become more "zoomed" in. However, I experience an error that I can't resolve. Firstly, I followed this post on how to render the tiles larger. This is ...
0
votes
1answer
30 views

How to get object or its index from mouse coordinates? [closed]

Basically, I have a NumPy array of rectangles that store their colour and position. I want to be able to compare my mouse position and clicked on the rectangle's position and get the index or the ...
0
votes
0answers
46 views

Are you supposed to be looping through all PhysicsObjects at every step in a physics engine?

I am currently making a small 2D game and I am trying to implement some basic 2D physics. I currently have a list of around 100 PhysicsObjects which I loop through every frame in order to update and ...
0
votes
1answer
91 views

Animating from json file in pygame?

I have got a json file and I am trying to load the single sprites from that file but I gives this error after a few loops and also the animation is not smooth(gets stuck) error: ...
0
votes
2answers
43 views

How can I create a boundary so the sprites don't go off screen?

I'm attempting to create a boundary around the window to stop the sprites of my game from escaping but it doesn't seem to be work, when they hit the area where its supposed to stop them it instead ...
1
vote
1answer
88 views

Using multiple pygame_gui managers

I would like to structure my gui into different panels. so to help keep my code managable i thought it might be a good idea to have a main panel. with its own manager and then a secondary panel with ...
1
vote
1answer
42 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 ...
0
votes
0answers
187 views

Failed to execute script {pygame.exe}

So I've made an game which just has a script named "TrainYourBrain.py". I wanted to make an exe of it but I failed. It just gives the error Failed to execute script TrainYourBrain My game ...
0
votes
0answers
32 views

How to load a new map when player reaches a certain point using if tile_object.name == 'door" (pygame)

I have been working on creating a 2d game, and I am now at the point where I want the character to be able to interact with his environment. I have created a few different obstacles such as a house, a ...
0
votes
0answers
73 views

How do I update this code to hit a moving target from a moving shooter?

I am working on a game where one spaceship("Origin") can shoot a dumb projectile("Projectile") at another spaceship("Target"). Since the target is moving we will have to ...
0
votes
0answers
599 views

Using pygame with multiple threads

I have decided to try out pygame. I created a class that is supposed to handle all the GUI and game related stuff. My idea is that I would have two seperate threads. One to handle the GUI and one to ...
0
votes
0answers
23 views

How can the game graphics be stabilised when after each frame hundreds of calculations are taking place? [duplicate]

I am building a very basic 2D game purely using pygame library in Python 3x. The "game object" is blit(ed) onto the screen using a loop and after each pass, there are calculations taking ...
0
votes
0answers
85 views

Scrolling background in PyGame with Entity Component System

I know this type of question has been asked to death for 'normal' games, however I am struggling with relating a scrolling background to an entity component system (ECS) approach. Generic samples here ...
1
vote
1answer
88 views

delta_time with discrete movement

I have a basic snake game movement system with Pygame: ...
0
votes
0answers
20 views

How to fix edge scrolling on a 2d scrolling camera?

Afternoon all, I just cannot get this to work properly and I'd really appreciate any help. I have a camera that follows the player around a 2d tile based map. However, I want the camera to move only ...
0
votes
0answers
33 views

Pygame - RPG Battle-Style Animation and movement when not controlled by player

Examples: https://www.youtube.com/watch?v=C2cOiFntLY4 https://www.youtube.com/watch?v=iHl1YFkeR78 I am making a small little RPG based on a text-adventure game that I made. This RPG involves a battle ...
0
votes
1answer
42 views

How to disable pause() in game_loop() once game_over() function is called?

How can I disable pause() in game_loop() once game_over() function is called? game loop ...
1
vote
1answer
28 views

I want my shapes to stay at screen

I am working on a paint project and it's almost complete but I want it to behave like the ms paint , in which whenever we draw an object (rectangle ,line) it shows it on the screen while we are moving ...
1
vote
1answer
95 views

How do I draw my particles when an enemy is killed?

I have enemies that move left and right. I was wonder how I could make my particles show up when the enemy is killed? Here is my particle class ...
1
vote
2answers
43 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. ...
1
vote
1answer
188 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 ...
1
vote
1answer
86 views

Problem With Enemy Bullets Attacking The Player Pygame

I am trying to make my enemy bullets attack the player but it only attack its x and y how could I make it curve instead of zigzagging VIDEO the bullets only attack the y axis and it wont curve or go ...
-1
votes
1answer
154 views

python sockets: receive data only when data is available?

I am writing an update to a game I have written in python, and I am currently adding server support. I can't show you the main code (for the client), as it is hundreds of lines long. However, what I ...
0
votes
1answer
36 views

EndScreen Not Loading My Best Score And Current Score How To Fix?

I am trying to make my endscreen save last score and current score but it just appears as 0 for both everytime I die event he I picked up the coins image so basically it isnt saving my coins I had and ...
0
votes
1answer
177 views

Pygame End Screen Problem How To Fix?

Video as you can see there I am trying to make my end screen restart my game but whats happening is that its not restarting my game its just loading the same thing when I die >> how could I make it so ...
0
votes
0answers
82 views

Enemies Bullet Shooting At Player Problem How To Fix?

I am trying to make my enemies shoot at my player rect where ever the position the player is and when it collides with the rect it should remove the -1 health ***my problem is that when the enemy ...

1
2 3 4 5
8