Mercurial > rinkhals
changeset 236:9a6ac9c9ff46
chickens turn to face target foxes
author | Adrianna Pińska <adrianna.pinska@gmail.com> |
---|---|
date | Sat, 05 Sep 2009 09:46:29 +0000 |
parents | d0760fccce14 |
children | 4a87bfa5cc63 |
files | gamelib/animal.py |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/gamelib/animal.py Sat Sep 05 09:23:16 2009 +0000 +++ b/gamelib/animal.py Sat Sep 05 09:46:29 2009 +0000 @@ -50,11 +50,11 @@ self._fix_face(new_pos) self.pos = new_pos - def _fix_face(self, final_pos): + def _fix_face(self, facing_pos): """Set the face correctly""" - if final_pos.left_of(self.pos): + if facing_pos.left_of(self.pos): self._set_image_facing('left') - elif final_pos.right_of(self.pos): + elif facing_pos.right_of(self.pos): self._set_image_facing('right') def _set_image_facing(self, facing): @@ -181,6 +181,7 @@ fox = self._find_killable_fox(weapon, gameboard) if not fox: return + self._fix_face(fox.pos) if weapon.hit(gameboard, self, fox): sound.play_sound("kill-fox.ogg") gameboard.kill_fox(fox)