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

learn more… | top users | synonyms

1
vote
0answers
21 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
0answers
24 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
24 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
10 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 = ...
0
votes
0answers
18 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 ...
0
votes
0answers
11 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
17 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
116 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
26 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
0answers
26 views

Pygame events work in Python2 but not Python3

When I run this code in Python2 it works (to read the keyboard), but in Python3 it doesn't. In Python3, I notice: The game window opens, but it doesn't come to the front. The terminal window stays ...
0
votes
1answer
40 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 ...
1
vote
0answers
36 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
59 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
15 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
158 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
0answers
35 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: ...
0
votes
2answers
106 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
46 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 ...
1
vote
0answers
55 views

Why is my partially transparent image blitted fully opaque?

I have a part in my program that should display the currently playing song's name for the first 4 seconds, then fade out. Even though Surface.get_alpha() returns expected results, the image still does ...
1
vote
1answer
139 views

How do I convert an image into a tile map?

I am working on a game in Pygame/Python, and I'd like to turn an image into a map. The idea is simple: Pixels in the image are colored by tile type. When the program loads the image, I want the color ...
1
vote
3answers
120 views

Scaling surface changes colors

I'm building a pixel art game with pygame, and I'd like to scale it to double the size. I have tried the pygame.transform methods like scale and scale2x, but they seem to alter the colors quite badly, ...
0
votes
1answer
80 views

What is the better way to speed up gameplay as the level rises?

I started with game programming couple of weeks back. For the starters I tried to develop ZigZag (link takes you to 2 min gameplay). I am done with the logic of gameplay by now. It runs well and ...
0
votes
2answers
60 views

How to detect a cursor inside a non-rectangle shape [duplicate]

How can I detect and do something if the cursor is inside a hexagonal shape? Is there any way other than detecting if it's in a rectangle area close to the shape of the hexagon? It would also have to ...
0
votes
1answer
57 views

Pygame 2D Vector Math Mouse Input

The following code is supposed to move a player sprite (in this case it's an 8x8 red square) to the coordinates of where the mouse is clicked. I'm able to move the square in the general direction of ...
0
votes
2answers
44 views

back-face (back-line) culling without winding order

In fooling around with my own 3D display engine I've been able to get a few modest features working, and I've come close with this latest one - line culling - but I fear in order to do it correctly ...
0
votes
0answers
49 views

Load Images in Pygame with XML

As the title suggests, I'm trying to find a way to load images in Pygame with xml, but my attempts have given me naught. XML script: <Creatures> <Creature> ...
2
votes
1answer
143 views

How can I support multiple player inputs in Pygame?

I'm trying to develop a team-based Asteroids game. It's going well except for the "multiple user inputs to a single machine" part. Can anyone recommend a method for getting and updating 6 players ...
1
vote
2answers
73 views

Playing a sound once pygame

I'm trying to play background music and the music keeps on starting. I tried to use music.busy, but I can't figure it out. I want it to check if sound/music is playing, then I want it to print "music ...
0
votes
2answers
54 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 ...
0
votes
1answer
164 views

Color detection

Is there a way to tell if a sprite is touching a specific color on the screen, maybe in a hex code. I know you can do $pygame.sprite.collide$ for sprites, but how can you do this for color on the ...
1
vote
1answer
582 views

How to remove the old sprites in pygame and show them at a different location

I am trying to show the motion of some basketballs towards walle using the pygae sprites. The idea is that I don't know how to remove the old ones so they won't show. Is there a move method so that it ...
0
votes
1answer
59 views

How to change the position of a circle in pygame in three stages

I will try to explain it as well as I can excuse me if I'll fail. I have the following simple game situation: I know the coordinates of each point. So each of the green points try to hit the blue ...
0
votes
1answer
52 views

Efficiently tracking active instances

I'm creating a game with lots of instances. On each iteration of the game loop, I only want to deal with the ones that are near the player. Currently, I do this by constructing a list of all the ...
0
votes
0answers
88 views

pygame.display.update(list) updates entire screen, not just rectangles in list

I have two "sprites", one following the mouse and one that moves with WASD. They aren't really pygame.sprite.Sprite objects, but they move like this: Paint over original position with that piece of ...
3
votes
2answers
885 views

Any way to embed Pygame in webpages?

I have a Pygame game, and I was wondering if there was any way to embed it into a webpage to make it easily playable, or if there is a games website that accepts Pygame games. EDIT: I am now using ...
0
votes
0answers
52 views

putting view 'effects' in the view - pygame

I have a project where I've tried to move 'visual effects' out of the sprite class's responsibility and into a 'screen manager' class, and before I get much further than effects like rotation and ...
1
vote
1answer
280 views

Pygame's sprite.collide_circle() missing several frames of head-on collision

I've spent hours trying to figure why my collision detection was so crappy, with sprites visibly ovellaping for several frames, when I noticed the culprit could be pygame's detection callback ...
0
votes
2answers
582 views

Pygame Surfaces: which (and when) do I need to .convert()?

I'm a bit puzzled about pygame's Surface.convert(): It's common sense that I should convert a surface after loading an image to it (presumably a jpg/png/etc file), but what about surfaces that I ...
1
vote
1answer
266 views

Pygame Scrolling Map

I have two questions. I'm working in a rogue-like and I've manage to implement a camera on the player, the camera shows just the players surroundings and is fixed in the side of the windows. The ...
0
votes
1answer
355 views

Chess Artificial intelligence with python and pygame [closed]

I created chess game with python and pygame. Now I'm trying to make Artificial intelligence, but what is actually best way to do it? Some tips, tricks, links? Thanks
1
vote
1answer
171 views

Splitting Pygame functionality between classes or modules?

I am attempting to make my pygame application more modular so that different functionalities are split up into different classes and modules. I am having some trouble getting pygame to allow me to ...
0
votes
1answer
77 views

Possible to pass pygame data to memory map block?

I am building a matrix out of addressable pixels and it will be run by a Pi (over the ethernet bus). The matrix will be 75 pixels wide and 20 pixels tall. As a side project, I thought it would be ...
6
votes
1answer
432 views

How do I measure the bounds of a string in PyGame?

I am trying to position some text on my screen using pygame, and knowing the size of the string would help. When using C# and XNA I could use SpriteFont.MeasureString("Hello World") to get the size ...
0
votes
1answer
115 views

Bounding Box Collision Glitching Problem (Pygame)

So far the "Bounding Box" method is the only one that I know. It's efficient enough to deal with simple games. Nevertheless, the game I'm developing is not that simple anymore and for that reason, ...
2
votes
2answers
737 views

Fade in screen in pyGame?

So I wanted to make my menu fade in when the game starts and fade out when it quits. To do so, I created a second surface and planned to fill it with black and then gradually increase alpha. So in the ...
-1
votes
1answer
340 views

theory behind rotation of a 3d cube using mouse

I want to rotate a 3d cube using mouse in python/pygame. Could someone explain the theory behind rotating a 3d cube by mouse? I dont understand how angleX, angleY and angleZ are affected by mouse ...
1
vote
1answer
379 views

How do I make a sprite move to another position using vectors

Ok, so far I have made the sprite move to a mouse position. But I got a question, does anyone know how to make a sprite move by itself without the use of a mouseclick from Point a to point b using ...
4
votes
2answers
1k views

Why does my turn-based game loop allow the enemy to act repeatedly?

I'm trying to create a turn-based game in pyGame but hit a wall when trying to properly handle the main game loop. So I have something like this: def loop(self): while self.stategame==1: ...
0
votes
1answer
127 views

How to display consistent background image

Drawing a large background is relatively slow in PyGame. In order to avoid drawing BG every frame, you could draw it once, then do nothing. However, if something is overdrawn onto the surface and ...