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

learn more… | top users | synonyms

0
votes
1answer
33 views

Pygame: Collision detection

i've been adding some extra stuff like Gravity and a table to a simple pong game made with Pygame and Python, the problem is that i dont know how to add collision detection, so when the ball hits the ...
0
votes
1answer
97 views

How to program destructibles?

I'm thinking about programming a 2d simulation of a spaceship that takes damage depending on where the projectile came from (e.g. from behind - engine, from the front - lasers, sides - hull, etc.). ...
1
vote
0answers
44 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 ...
0
votes
0answers
32 views

How To Point An Object At Cursor? [duplicate]

I'm trying to make a Nuclear Throne like game in python 3 and pygame, but I got stuck at how to make the gun point at the cursor. If someone could show me how, that would be great. :D I looked at the ...
0
votes
2answers
64 views

PYGAME: When i realese two directional keys together the player keep moving

I did the code this way to avoid the player to stop if a press two directional keys together making the moviment more smooth. It work well but when i realease two keys or more together the player keep ...
4
votes
2answers
97 views

Line Collision In Pygame?

I am working on a game(a platformer) that is physics and momentum based. I want to make it so that the player(a single dot) can bounce off of the lines with correct physics, but to do that, I need to ...
0
votes
2answers
80 views

Rotating hitboxes in pygame?

I'm using pygame.rect.colliderect() to check hitbox collision between sprites in my game, but now that i'm rotating the sprites, I'm realizing I can't do this because there's no way to rotate a pygame ...
0
votes
2answers
81 views

Fast Flood Fill in Pygame?

I am creating a simple game in Pygame for my kids. It involves intersecting random complex curves. Some of the intersections can be coloured in different colours. I have implemented a flood fill ...
0
votes
1answer
44 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.
0
votes
0answers
35 views

Pygame image blitting makes game lag

So I have a tile-based game that is 216X384 units large. Each square in the cell_array is grass, which I pre-loaded with convert_alpha(). Each time it draws (I have fps at 30), it cycles through the ...
0
votes
0answers
20 views

Pygame Colorkey works on the image surface but not on the screen

I running pygame on python 3.2.3 and trying to make a pygame 3 Agar clone. I've created simple sprite objects using draw.circle and drawn them to their own surface called image. I've then used ...
0
votes
1answer
56 views

How to figure out which tiles are within view, and where to draw them in the grid

I know there are a few questions on here similar to mine, but none of them seem to fit my needs. I'm using pygame to implement a tile based game similar to final fantasy or zelda from the early ...
-1
votes
1answer
44 views

How do I get a vector from an angle?

I want a ship to move forward in the direction it's facing when you press the up key, but I don't know how to get a normalized vector from the angle the ship is facing. Can someone show me what code ...
0
votes
1answer
231 views

pygame for python 3.5

I am running python 3.5 and I want to install pygame, the website only supports up to version 3.2. I have tried a few forums on this and other websites but they are all for python 3.4. Does anyone ...
2
votes
1answer
48 views

Pygame time.get_fps() value

I was looking at the pygame.time.Clock.get_fps() method and after puting it inside of the while loop printing and checking it some times, i see that i starts to give its value after five frames (and ...
2
votes
1answer
142 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 ...
0
votes
0answers
40 views

how to increase lenght and make body of snake in pygame

I'm programming a snake game and I'm not sure how increase the length of the snake. Main part of code: lead_x=300 lead_y=300 dirx=right(default) if dirx=='right': lead_x +=...
0
votes
2answers
22 views

(Pygame) Sprite disappearing on collision

I am making a game, and when the player runs into a certain block it changes the size of a circle on the top. The problem is, whenever the player runs into the block it disappears. How can I fix this?
0
votes
0answers
16 views

Spritesheet trouble / code review

http://stackoverflow.com/questions/34563084/spritesheet-trouble-code-review If the player presses right, i have an image of a guy facing right. Left, up, and down same concept. if he holds the button,...
0
votes
1answer
42 views

Remove bullets from sprite Group

I'm having an issue with removing objects from a sprite Group. What is happening is I have a bullet class and every time the user presses the player shoots a bullet. I have 'alive = bool' code and ...
0
votes
0answers
38 views

How can I make bullets go to the cursor in Pygame properly

So hey, I'm new into making games and programming at all, I tried to make a small game thingy in Pygame that would include a dude shooting bullets and stuff. However, I can't really get the shooting ...
0
votes
1answer
41 views

Pygame making Snake, need help with generating fruit with a random color

This is my function for generating an apple, I want it to generate a random color each time the snake eats it. def AppleGenerator(): fruit_colors = [crimson,powderblue,yellow,hotpink,...
1
vote
1answer
28 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 ...
2
votes
1answer
117 views

Pygame freezing on QUIT

I'm having problems with quitting a Pygame application (6502 based computer emulator). The part regarding exit looks like this: while True: do_something_200_times() for event in pygame.event....
2
votes
0answers
40 views

Does the latest version of Python have libraries for easy host/server connections? [closed]

We're working on a turn-based multiplayer Risk-type strategy game in Pygame, and I was wondering if there were any pre-existing libraries like PodSixNet that worked for Python versions 3 and up that ...
2
votes
1answer
150 views

Move an enemy towards the player in pygame

I set variables for the distance between the enemy and the player along the x-axis and y-axis. My plan is to move the enemy along the hypotenuse formed by y and x-axis line at a constant speed. The ...
0
votes
1answer
122 views

How do I check if pressed on a text in pygame?

How do I check if pressed on a text? This is how I draw the text: # Full code on https://github.com/Zwengel/bunny-badgers height = pygame.display.Info().current_h font = pygame.font.Font("...
0
votes
0answers
15 views

Python & Pygame: How do I use this animated gif as background surface? [duplicate]

How would I go about putting an animated gif into my game in Pygame? I'm following along on the tutorial at inventwithpython (source) slidepuzzle.py My code is very similar, as I'm just beginning how ...
0
votes
1answer
126 views

how to generate road in racing game

I'm making a racing game in python and I kind of wrote myself into a corner. This for loop: for i in objects: if i.name == "road": if i.y == 0: road = Road(road_x,-...
1
vote
1answer
357 views

Pygame Fullsreen Display Issue

Code: import pygame pygame.init() # def Main(display,colors): clock =pygame.time.Clock() # surface = pygame.Surface(surface_resolution) # Create main surface surface.fill(colors["RED"]...
0
votes
2answers
70 views

Pygame Scrolling Camera bug

I asked a question the other day about how to implement a scrolling camera. I got a great answer which helped me achieve that... but in doing so I have lost basically all collision detection. ...
1
vote
2answers
584 views

Pygame - implementing a scrolling camera

I am currently making a 2d game in Pygame and have run into a roadblock trying to make a scrolling camera (follows the character). I have seen some other answers to similar questions, but they have ...
1
vote
1answer
70 views

scrolling ruining bullet physics

the code below is the bullet class for my shooter game in pygame. as you can see if you run the full game (https://github.com/hailfire006/economy_game/blob/master/shooter_game.py) the code works ...
0
votes
1answer
118 views

How do I get pygame to work on intel processor?

I downloaded Python 3.4 64 bit IDE and pygame but whenever I tried installing pygame it would say "Not supported on Intel". So are there version of pygame available for Intel processor or are there ...
0
votes
1answer
249 views

Diagonal Movement with Pygame Rect Class

I have been using pygame and have been struggling to understand how to implement vectors and the pygame rect class to make an image move diagonally on the screen at the correct speed.I know it must be ...
0
votes
1answer
35 views

Pygame.display.set_icon unable to show transparecy

On Python 3.2.5 32 bit, I installed pygame. I made some code with it. It included pygame.display.set_icon(image). The image file is .png and I loaded it by using image = pygame.image.load("clockico....
0
votes
1answer
132 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 ...
1
vote
1answer
46 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. ...
0
votes
1answer
41 views

Keep Image from Drawing Outside Game Area

I was playing around with a pygame tutorial (link for those interested). One thing the tutorial has you do is create a cloud that crosses the screen. Now, the game has a small bit bar at the bottom ...
0
votes
1answer
2k views

Locking the frame rate in pygame?

I am having trouble setting up the frame rate in my first game. I know that I can set it up with clock = pygame.time.Clock() clock.tick(60) but this is not producing very desirable results. If I ...
1
vote
1answer
91 views

How to iterate a sprite group correctly in Pygame avoiding “maximum recursion depth exceeded”?

I'm making a game and I have almost finished it, but I'm usually finding the error RuntimeError: maximum recursion depth exceeded when I iterate a sprite group. This is an example and the group is ...
0
votes
1answer
134 views

In Pygame, I can only display text once I stop updating and drawing, why?

At this moment, I can only display text once I stop updating and drawing sprites. In the code below (which is actually the game loop), you can see how if GAMEOVER == True (gameloop stops drawing), the ...
2
votes
1answer
122 views

Collision detection with PyGame

I have been making a 2d platformer using Python with PyGame. It has all be going good, but I have stumbled accross many problems with collision detection. Here they are: You can't go through objects ...
0
votes
0answers
132 views

My sprites do not always respect collisions in Pygame

I have a Player sprite (40x40 pixels) and Tiles (20x20 pixels) which build the terrain. At the 4 edges there are 2 rows or columns (depends on vertical or horizontal) of wall tiles. Those are the ...
16
votes
2answers
3k views

Why does my sprite player move faster when I move the mouse?

I'm trying to develop a simple game made with Pygame (Python library). I have a sprite object which's the player and I move it using arrow keys. If I don't move the mouse, the sprite moves normally, ...
0
votes
1answer
25 views

Game Opens then Stops Responding Python

Sorry for the bad title, if you think of a better one please tell me. So I was asked to make a button that says a line from a video game. I attempted to have the while loop add 1 to a variable every ...
-3
votes
1answer
175 views

Performance of programming languages and frameworks [closed]

I want to program an online 2D MMORPG with graphics like in this game. Since I develop in javascript and python mainly I chose python for my first games and the game library pygame which is pretty ...
0
votes
1answer
82 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/...
0
votes
2answers
190 views

How to create old-school format music with small file sizes

My friend and I have been working on a project recently, and because we are hard coding everything (other than the graphics library, Pygame), the total size for our project is super small. I feel like ...
0
votes
1answer
92 views

I want to blit a standing man on pygame [closed]

I was making a game with pygame and python and I wanted to blit an image of a standing man and when a right key is pressed I want the man to run and when the right key is released I want the man to ...