Mercurial > mamba
changeset 385:80ba03bec6ad
Make arrows work
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Sat, 17 Sep 2011 01:35:02 +0200 |
parents | 91655634a280 |
children | d760a309d0bf |
files | TODO.txt mamba/snake.py mamba/sprites.py |
diffstat | 3 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/TODO.txt Sat Sep 17 01:31:02 2011 +0200 +++ b/TODO.txt Sat Sep 17 01:35:02 2011 +0200 @@ -12,7 +12,7 @@ Paging for level screen Packaging Test on Windows -Arrows only kill you if you hit the pointy end +Improve Arrow behavior when on arrow and arrow rotator button why does my snake jump twice when I press escape to leave a level? Sleep Editor:
--- a/mamba/snake.py Sat Sep 17 01:31:02 2011 +0200 +++ b/mamba/snake.py Sat Sep 17 01:35:02 2011 +0200 @@ -101,6 +101,9 @@ # Cap queue length: self._orientation_changes = self._orientation_changes[:3] + def force_new_direction(self, orientation): + self._orientation_changes.insert(0, orientation) + def _pop_orientation_queue(self): while self._orientation_changes: orientation = self._orientation_changes.pop(0)
--- a/mamba/sprites.py Sat Sep 17 01:31:02 2011 +0200 +++ b/mamba/sprites.py Sat Sep 17 01:35:02 2011 +0200 @@ -204,6 +204,10 @@ RIGHT: DOWN, DOWN: LEFT}[self.direction]) + def interact(self, world, segment): + world.snake.force_new_direction(self.direction) + super(ArrowSprite, self).interact(world, segment) + class FlipArrows(SingleImageTileSprite): image_name = 'flip-arrows'