PyGameEngine

I began work today on a new game engine for use with Pygame. Right now, it only has classes and functions to facilitate cameras and camera movement. There’s also a working demo for the camera class. It is in a pre-alpha version and has many known bugs. Including ones as simple as making a background larger than the camera. But it seems more stable than many other engines out there.

Here’s an example of a simple use of the game engine:

from PyGameEngine import *

class NewSprite(GameSprite):

...

def main():
background = pygame.surface.Surface((800,600))
background.fill((65,0,0))
pygame.draw.line(background, (255,255,255), (0,0), (background.get_rect().width-1, 0), 9)
pygame.draw.line(background, (255,255,255), (background.get_rect().width-1, background.get_rect().height-1), (background.get_rect().width-1, 0), 9)
pygame.draw.line(background, (255,255,255), (0, background.get_rect().height-1), (background.get_rect().width-1, background.get_rect().height-1), 9)
pygame.draw.line(background, (255,255,255), (0, 0), (0, background.get_rect().height-1), 9)

game = Game(screensize=(800, 600), caption="PyGameEngine testing", background=background, bgcolor=Color(40,0,0), backgroundfixed=False, fullscreen=False, maxfps=30, debug=True)

spritesurf = pygame.surface.Surface((32, 32))
spritesurf.fill((255,255,255))
testSprite = NewSprite(game, image=spritesurf, bounds=Rect(0,0, 800,600))
game.centerOn = testSprite
testSprite.centerOn(Rect(0,0, 800,600).center)
testGroup = GameSpriteGroup(game, [testSprite])
game.addGroup(testGroup)
game.playersprite = game.groups[0].sprites()[0]

game.run()

if __name__ == '__main__':
main()

I will upload the source code as soon as I feel it’s ready. I may upload a video of the working demo though.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: