pygame

Playing sounds with python and changing their tone during playback?

Is there a way to do this? Also, I need this to work with pygame, since I want audio in my game. I'm asking this because I didn't see any tone change function in pygame.. Anyone knows? Update: I need to do something like the noise of a car accelerating. I don't really know if it is timbre or tone. ...

Making a C extension to Python that requires another extension

I have a couple of Python functions that I use to make game development with Pygame easier. I have them in a file called helper.py in my Python-path, so I can import them from any game I make. I thought, as an exercise to learn about Python extensions, to convert this module to C. My first problem is that I need to use functions from Pyg...

positioning sound with pygame?

Is there a way to do panning or 3d sound in Pygame? The only way I've found to control sound playback is to set the volume for both the left and right channels. ...

Wait for an event, but don't take it off the queue

Is there any way to make the program sleep until an event occurs, but to not take it off the queue? Similarly to http://www.pygame.org/docs/ref/event.html#pygame.event.wait Or will I need to use pygame.event.wait, and then put that event back onto the queue? Just to clarify, I do not need to know what that event is when it occurs, jus...

What is the right way to design an adventure game with PyGame?

I have started development on a small 2d adventure side view game together with a couple of people. The game will consist of the regular elements: A room, a main character, an inventory, npcs, items and puzzles. We've chosen PyGame since we all are familiar with python from before. My question is quite theoretical, but how would we desig...

Engines built on pygame

I am currently writing an RTS for pygame and have written a number of modules on top of pygame for common things, such as efficient collision detection, a state system and more featured sprites. Now while writing games, except for Rect and Surface, I barely write any calls to Pygame itself. When Googling around on this, I have not fou...

Modern, Non-trivial, Pygame Tutorials?

What are some 'good', non-trivial Pygame tutorials? I realize good is relative. As an example, a good one (to me) is the one that describes how to use pygame.camera. It's recent uses a modern PyGame (1.9) non-trivial, in that it shows how to use it the module for a real application. I'd like to find others. A lot of the ones on ...

Adventure game - walking around inside a room.

I'm working on an adventure game in Python using Pygame. My main problem is how I am going to define the boundaries of the room and make the main character walk aroud without hitting a boundary every time. Sadly, I have never studied algorithms so I have no clue on how to calculate a path. I know this question is quite general and hard t...

How do I blit a PNG with some transparency onto a surface in Pygame?

I'm trying to blit a PNG image onto a surface, but the transparent part of the image turns black for some reason, here's the simple code: screen = pygame.display.set_mode((800, 600), pygame.DOUBLEBUF, 32) world = pygame.Surface((800, 600), pygame.SRCALPHA, 32) treeImage = pygame.image.load("tree.png") world.blit(treeImage, (0,0), (0,0...

Is there any way to "clear" a surface?

Just wondering... Is there any way to clear a surface from anything that has been blitted to it? ...

Walkcycles and timing in pygame

I have a pygame.Timer running in my game calling a draw function 32 times/second. The drawing method gets positions from all elements on my screen and blits them accordingly. However, I want the main character to walk around slower than other objects move. Should I set up a timer specifically for it or should I just blit the same frames...

Python, Pygame, Pyro: How to send a surface over a network?

I am working on a project in python using pygame and pyro. I can send data, functions, classes, and the like easily. However, I cannot send a surface across the wire without it dying on me in transit. The server makes a surface in the def __init__ of the class being accessed across the wire: self.screen = pygame.display.set_mode(SCREEN...

Embedding Gnash into PyGame?

Is there a way to display flash applications using Gnash renderer (I'm not averse to Adobe's renderer but would prefer not to use it) in a PyGame application? ...

Pack program *and* dynamically loaded files into single executable? (python + pygame, or language agnostic)

There are plenty of great answers to questions about making a standalone executable, but I can't figure out how to pack art assets (or dynamically loaded files) into it as well. Why would I want to do this? Because it would be great to distribute a simple (throw away) game that lives entirely in a single executable with no installer. ...

pygame and postgresql

How to draw vector objects from database in python with pygame? ...

C lib with Python bindings where both want to render

I'm sketching on some fluid dynamics in Python. After a while, I'm looking for a bit more speed, so I rewrote the actual logic in C and put up some Python bindings (using SWIG). My problem now is that I don't how to render it in a good way. The logic is run pixel by pixel so pixels are what I want to track and render. Python gives my a...

Intersection between bezier curve and a line segment

I am writing a game in Python (with pygame) that requires me to generate random but nice-looking "sea" for each new game. After a long search I settled on an algorithm that involves Bezier curves as defined in padlib.py. I now need to figure out when the curves generated by padlib intersect a line segment. The brute force method would b...

python pygame + tkinter + py2exe = Segmentation Fault

Hi all, I have made a pygame application, which I sucessfuly compiled to an exe using the pygame2exe script from pygame website. Now I made a small launcher with startup options for the application, using Tkinter, and everything work smoothly. The problem comes when I try to compile the application to exe, using the same script as abo...

Howto Embed , load .swf into Pygame?

Hi all, How to load a .swf(flash) file in Pygame? THANK YOU. ...

Pygame sprite transformation with interpolation

Im currently working on a Python/Pygame module to wrap some basic sprite animation. Animation in the sense that the image itself is static but I apply rotation and scale with start and end values with a sine wave interpolation. That is, sprite transformation like the ones that could be made in Flash. I hope you understand, otherwise feel...