public
Description: A library for Python/PyGame that imitates features from Fenix.
Homepage:
Clone URL: git://github.com/Fiona/pygame-fenix.git
name age message
file .gitignore Sun Mar 29 10:43:57 -0700 2009 Fixed bugs in 'exists' and 'normalise_angle' [Frimkron]
file README.md Sun Jan 18 05:17:17 -0800 2009 mend [Fiona]
directory examples/ Fri Jul 03 22:01:05 -0700 2009 Added my lightning-talk example and annotated i... [Fiona]
directory fenix/ Sun Oct 18 14:41:28 -0700 2009 added option to signal processes by class [Frimkron]
README.md

Pygame-Fenix (By Fiona Burrows)

Requirements:

  • Python 2.5
  • PyGame 1.8

Description

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.

Example

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()