- Python 2.5
- PyGame 1.8
pygame-fenix is a library for Python that allows one to write games with Pygame, but using concepts such as processes and frames inspired by Fenix.
It uses an actor based model for game objects, automatically handling rendering in the game world. All the developer has to do is tell it where things need to go.
Generators are used to simulate a frame system. Rather than a monolithic game loop for your objects, you can have your object stop at a specific point in it's code and continue on in the next frame.
It also includes helpful routines such as getting the distances between two processes, collision detection and easy input routines.
This example will display a character on screen. The player use the cursor keys to rotate the character and move him backwards/forwards (like a car).
For more examples check the "examples" directory.
import pygame
from fenix.program import Program
from fenix.process import Process
class Game(Process):
def begin(self):
Program.set_mode((800,600))
Program.set_fps(60)
My_guy()
class My_guy(Process):
def begin(self):
self.graph = Program.load_png("my_guy.png")
self.x, self.y = 400, 300
while True:
if(Program.key(K_LEFT)):
self.angle -= 5000
if(Program.key(K_RIGHT)):
self.angle += 5000
if(Program.key(K_UP)):
self.advance(2)
if(Program.key(K_DOWN)):
self.advance(-1)
yield
Game()