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
11 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 = ...
0
votes
1answer
16 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
16 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
0answers
12 views

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

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
164 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 ...
0
votes
1answer
49 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 = ...
1
vote
1answer
42 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 ...
0
votes
1answer
27 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
1answer
68 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 ...
1
vote
2answers
63 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 ...
0
votes
2answers
31 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
1answer
39 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
367 views

Collision in PyGame for spinning rectangular object.touching circles

I'm creating a variation of Pong. One of the differences is that I use a rectangular structure as the object which is being bounced around, and I use circles as paddles. So far, all the collision ...
1
vote
2answers
691 views

Detecting walls or floors in pygame

I am trying to make bullets bounce of walls, but I can't figure out how to correctly do the collision detection. What I am currently doing is iterating through all the solid blocks and if the bullet ...
1
vote
3answers
131 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
183 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 ...
0
votes
1answer
14 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
1answer
27 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 ...
10
votes
1answer
5k views

Doing an SNES Mode 7 (affine transform) effect in pygame

Is there such a thing as a short answer on how to do a Mode 7 / mario kart type effect in pygame? I have googled extensively, all the docs I can come up with are dozens of pages in other languages ...
4
votes
1answer
880 views

How do I support animation with frames of different sizes?

I'm trying to create a simple top-view 2D rpg, in the style of Zelda and Secret of Mana, using PyGame. I've managed to make the beginnings of a game, with an animated character walking around. ...
1
vote
1answer
540 views

How to debug a 2D arcade game easily?

I am trying to learn pygame. In order to do that, I have downloaded one of their examples : http://rpg-world.googlecode.com/files/rpg-world-src-0.93.tar.gz And started to run it in debug mode. ...
0
votes
1answer
23 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 ...
1
vote
1answer
28 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
32 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
45 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
2answers
9k views

Pygame How To Use Collision?

Can someone tell me how to implement collision in Pygame? For example I have a sprite called A and another one called B. How do I detect if they collide in Pygame?
0
votes
0answers
65 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 ...
1
vote
0answers
40 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 ...
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
162 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
41 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
113 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
50 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
58 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
3answers
4k views

Will I have an easier time learning OpenGL in Pygame or Pyglet? (NeHe tutorials downloaded) [closed]

I'm looking between PyGame and Pyglet, Pyglet seems to be somewhat newer and more Pythony, but it's last release according to Wikipedia is January '10. PyGame seems to have more documentation, more ...
1
vote
2answers
3k views

How can a pygame image be colored?

How can I color a Pygame image surface? I either want to change every pixel that is color A into color B, or else change every pixel into color B. Either works, so long as transparent regions remain ...
3
votes
1answer
588 views

How to march tiles together like in Terraria?

I've been trying to get tile marching to work like in Terraria, and I got something to work. I don't think it's actually very good way of doing this, so I'm wondering what would be really the main way ...
1
vote
1answer
172 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 ...
0
votes
1answer
83 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
61 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 ...
1
vote
2answers
77 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
1answer
60 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 ...
2
votes
5answers
4k views

RPG movement holding down button

I've been writing a simple top down mini RPG in python. My problem is that when I move the player I have to repeatedly tap the arrow key. Each time I tap the key the player moves 5 PX in the ...
0
votes
2answers
45 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
4answers
5k views

smooth movement pygame

Hello im trying to learn more about smoother movement in games. I have created a little program to hopefully help me understand this. As far as i can tell i am suppose to track time, and update ...
2
votes
1answer
147 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 ...
0
votes
0answers
53 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> ...
3
votes
2answers
962 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 ...
1
vote
1answer
292 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 ...