Mercurial > mamba
diff mamba/snake.py @ 78:b1019923cb12
Direction control for snake.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Sun, 11 Sep 2011 18:29:49 +0200 |
parents | |
children | f602a8c3d173 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mamba/snake.py Sun Sep 11 18:29:49 2011 +0200 @@ -0,0 +1,19 @@ +"""The player snake object.""" + +from mamba.sprite import BaseSprite + + +class Snake(BaseSprite): + + UP, DOWN, LEFT, RIGHT = range(4) + + def __init__(self, tile_pos, orientation): + super(Snake, self).__init__("snake/" + "snake-head-mouth-open-r.png") + self.set_tile_pos(tile_pos) + self.set_orientation(orientation) + + def set_orientation(self, orientation): + self._orientation = orientation + print ["UP", "DOWN", "LEFT", "RIGHT"][orientation] + # TODO: update image