Mercurial > mamba
annotate mamba/snake.py @ 98:7ce2d2d8381a
Refactor BaseSprite.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Sun, 11 Sep 2011 19:25:11 +0200 |
parents | f602a8c3d173 |
children | e6299eb296ce |
rev | line source |
---|---|
78 | 1 """The player snake object.""" |
2 | |
79
f602a8c3d173
Fix bugs. Stubbed out get_entry for now.
Simon Cross <hodgestar@gmail.com>
parents:
78
diff
changeset
|
3 from mamba.sprites import BaseSprite |
98 | 4 from mamba import mutators |
78 | 5 |
6 | |
7 class Snake(BaseSprite): | |
8 | |
9 UP, DOWN, LEFT, RIGHT = range(4) | |
10 | |
11 def __init__(self, tile_pos, orientation): | |
98 | 12 super(Snake, self).__init__(image_name="snake/" |
79
f602a8c3d173
Fix bugs. Stubbed out get_entry for now.
Simon Cross <hodgestar@gmail.com>
parents:
78
diff
changeset
|
13 "snake-head-mouth-open-r") |
98 | 14 self.load_images() |
78 | 15 self.set_tile_pos(tile_pos) |
16 self.set_orientation(orientation) | |
17 | |
98 | 18 def load_images(self): |
19 pass | |
20 | |
78 | 21 def set_orientation(self, orientation): |
22 self._orientation = orientation | |
23 print ["UP", "DOWN", "LEFT", "RIGHT"][orientation] | |
24 # TODO: update image | |
98 | 25 |
26 | |
27 class Head(object): | |
28 pass |