comparison gamelib/gameboard.py @ 530:c1f14fa35d30

Avoid buglet where sprite isn't properly removed for a safe fox
author Neil Muller <drnlmuller@gmail.com>
date Fri, 27 Nov 2009 21:13:43 +0000
parents 04975aa3ec70
children 1a224ba50edf
comparison
equal deleted inserted replaced
529:93eab01a1e57 530:c1f14fa35d30
911 chicken.chop() 911 chicken.chop()
912 self.calculate_wood_groat_exchange_rate() 912 self.calculate_wood_groat_exchange_rate()
913 913
914 def foxes_move(self): 914 def foxes_move(self):
915 over = True 915 over = True
916 for fox in self.foxes: 916 for fox in self.foxes.copy():
917 old_pos = fox.pos 917 old_pos = fox.pos
918 fox.move() 918 fox.move()
919 if not fox.safe: 919 if not fox.safe:
920 over = False 920 over = False
921 self._pos_cache.update(old_pos, fox, 'fox') 921 self._pos_cache.update(old_pos, fox, 'fox')
922 else:
923 # Avoid stale fox on board edge
924 self.remove_fox(fox)
922 return over 925 return over
923 926
924 def foxes_attack(self): 927 def foxes_attack(self):
925 for fox in self.foxes: 928 for fox in self.foxes:
926 fox.attack() 929 fox.attack()