Questions tagged [pygame]

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

Pygame is a set of Python modules designed for writing games. Pygame adds functionality on top of the excellent SDL library. This allows you to create fully featured games and multimedia programs in the python language.

See the official site for reference and the documentation.

479 questions
23
votes
2 answers

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 (asm, c) with lots of strange-looking equations and…
2D_Guy
  • 231
  • 1
  • 2
  • 4
9
votes
2 answers

Increase blitting speed?

I'm working on a 2d sidescroller in PyGame. For each map we use one texture (this is the actual size of the texture): Then we load the image with this code: sprite = pygame.image.load("Maps/MapTesting.png") sprite.convert() sprite =…
orlp
  • 364
  • 3
  • 11
4
votes
2 answers

Pygame surfaces and their Rects

I am trying to understand how pygame surfaces work. I am confused about Rect position of Surface object. If I try blit surface on screen at some position then Surface is drawn at right position, but Rect of the surface is still at position (0,…
Jaka Novak
  • 41
  • 1
  • 1
  • 2
3
votes
1 answer

Find out what word you are hovering mouse over

I want to be able to pop up something when the user hovers over particular words that are on a label in pygame. Can anyone give me a good (or even bad) idea on how to implement this (doesn't have to be pygame specific)? Do I have to put each word in…
Olivier
  • 33
  • 4
2
votes
2 answers

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 constructor I added: self.fadeInSurface =…
Straightfw
  • 175
  • 1
  • 8
1
vote
1 answer

Lightning Effect PyGame

I want to create a Lightning Effect Like http://www.youtube.com/watch?feature=player_embedded&v=mmU2GAYGVSU for my game. The following blog explains it briefly but I am not able to understand the following line: midPoint +=…
1
vote
2 answers

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 PyGame website has piles of different versions of the…
user2403876
  • 11
  • 1
  • 1
  • 2
1
vote
0 answers

Why don't people use try-finally to call pygame.quit() in pygame programs?

I've seen several games made in Pygame, and none of them uses try/finally to call pygame.quit() when it finishes. Instead of writing: def main(): pygame.init() try: ... finally: pygame.quit() and using sys.exit() to…
Orisphera
  • 11
  • 2
1
vote
1 answer

What is the easiest way to make pixelated maps with obstacles in pygame?

So I have been trying to create a game with a small map that moves with the player. If the player goes to a wall, the camera also stops. No scrolling. If you want to discover an area, you go to it. And there are many obstacles. the map should be…
1
vote
2 answers

How to make objects move continuously while a key is pressed in pygame?

So I made a new game in pygame and after hours of debugging, I got to a stage where all of my objects get blitted onto the screen. Well, that's great but now I want movement for a particular object. I achieved that task easily enough, but I was…
1
vote
1 answer

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 our mouse . I implemented it for only one object…
1
vote
0 answers

how do i convert my pygame games to executable

I have a lot of python games I made in pygame and want to compile them so I can distribute them on sites like itch.io and gamejolt.com, the thing is, when I try to my executable game it says "fatal error detected" and "failed to execute script…
1
vote
1 answer

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: class Rect(pygame.sprite.Sprite): def…
1
vote
1 answer

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 idle sprite I found on the internet. My question…
Tangtaizong
  • 25
  • 1
  • 8
1
vote
2 answers

Adjusting collision hitbox size with Pygame

So I coded a 2d sidescrolling platform, everything is fine except this: As you can see, the sprite is standing at the platform when her feet is not in the platform anymore. I want to adjust the collision hitbox size so that when her feet is not on…
Tangtaizong
  • 25
  • 1
  • 8
1
2