Mercurial > rinkhals
view gamelib/buildings.py @ 47:be2496df2368
Add egg image to egg sprite.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Mon, 31 Aug 2009 16:57:39 +0000 |
parents | fb5be14ea930 |
children | 08665fa60345 |
line wrap: on
line source
"""Classes for various buildings in the game.""" from pgu.vid import Sprite import imagecache class Building(Sprite): """Base class for buildings""" def __init__(self, image, pos): # Create the building somewhere far off screen Sprite.__init__(self, image, (-1000, -1000)) self.pos = pos def loop(self, tv, _sprite): ppos = tv.tile_to_view(self.pos) self.rect.x = ppos[0] self.rect.y = ppos[1] def move(self, state): """Given the game state, return a new position for the object""" # Default is not to move return self.pos class HenHouse(Building): """A HenHouse.""" def __init__(self, pos): image = imagecache.load_image('sprites/henhouse.png') Building.__init__(self, image, pos)