Mercurial > rinkhals
changeset 28:ac3a74352b74
Change animal.py to four space indents.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Sun, 30 Aug 2009 18:23:40 +0000 |
parents | 049d5a19073b |
children | 2e88c680672c |
files | gamelib/animal.py |
diffstat | 1 files changed, 29 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/gamelib/animal.py Sun Aug 30 18:23:15 2009 +0000 +++ b/gamelib/animal.py Sun Aug 30 18:23:40 2009 +0000 @@ -6,47 +6,46 @@ import data class Animal(Sprite): - """Base class for animals""" + """Base class for animals""" - def __init__(self, image, pos): - Sprite.__init__(self, image, pos) - self.pos = pos + def __init__(self, image, pos): + Sprite.__init__(self, image, pos) + 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 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 + def move(self, state): + """Given the game state, return a new position for the object""" + # Default is not to move + return self.pos class Chicken(Animal): - """A chicken""" + """A chicken""" - def __init__(self, pos): - image = pygame.image.load(data.filepath('sprites/chkn.png')) - Animal.__init__(self, image, pos) + def __init__(self, pos): + image = pygame.image.load(data.filepath('sprites/chkn.png')) + Animal.__init__(self, image, pos) - def move(self, gameboard): - """A free chicken will move away from other free chickens""" - return self.pos + def move(self, gameboard): + """A free chicken will move away from other free chickens""" + return self.pos class Egg(Animal): - """An egg""" + """An egg""" - # Eggs don't move + # Eggs don't move class Fox(Animal): - """A fox""" - - def __init__(self, pos): - image = pygame.image.load(data.filepath('sprites/fox.png')) - Animal.__init__(self, image, pos) + """A fox""" - def move(self, gameboard): - """Foxes will aim to move towards the closest henhouse or free + def __init__(self, pos): + image = pygame.image.load(data.filepath('sprites/fox.png')) + Animal.__init__(self, image, pos) + + def move(self, gameboard): + """Foxes will aim to move towards the closest henhouse or free chicken""" - return self.pos - + return self.pos