Mercurial > mamba
annotate 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 |
rev | line source |
---|---|
78 | 1 """The player snake object.""" |
2 | |
3 from mamba.sprite import BaseSprite | |
4 | |
5 | |
6 class Snake(BaseSprite): | |
7 | |
8 UP, DOWN, LEFT, RIGHT = range(4) | |
9 | |
10 def __init__(self, tile_pos, orientation): | |
11 super(Snake, self).__init__("snake/" | |
12 "snake-head-mouth-open-r.png") | |
13 self.set_tile_pos(tile_pos) | |
14 self.set_orientation(orientation) | |
15 | |
16 def set_orientation(self, orientation): | |
17 self._orientation = orientation | |
18 print ["UP", "DOWN", "LEFT", "RIGHT"][orientation] | |
19 # TODO: update image |