# HG changeset patch # User Neil Muller # Date 1302350208 -7200 # Node ID 3ac03073218fe7016c079b711d1c53d952b74ce4 # Parent 4e158a7bd11976865ae8c35411ec29784de89807 Don't allow tranformations if they'll get us stuck diff -r 4e158a7bd119 -r 3ac03073218f skaapsteker/sprites/player.py --- a/skaapsteker/sprites/player.py Sat Apr 09 13:47:21 2011 +0200 +++ b/skaapsteker/sprites/player.py Sat Apr 09 13:56:48 2011 +0200 @@ -68,12 +68,13 @@ cand_collide_rect.midbottom = cur_pos # We always allow the attacking animation frames if not self.check_collide_rect(cand_collide_rect, cand_rect, cand_image) and not self.attacking: - return + return False self.image = cand_image self.collide_rect = cand_collide_rect self.rect = cand_rect self.rect_offset = cand_rect_offset self.init_pos() + return True def update(self): self._touching_actionables = [] @@ -225,12 +226,18 @@ if self.shape == 'fox': # Become human if self.the_world.fox.has_fan: - self.the_world.fox.shape = 'human_with_fan' + self.shape = 'human_with_fan' else: - self.the_world.fox.shape = 'human' + self.shape = 'human' else: - self.the_world.fox.shape = 'fox' - self.shape = self.the_world.fox.shape + self.shape = 'fox' + # Check the transformation is feasible + if self.set_image(): + # Transformation succeeded + self.the_world.fox.shape = self.shape + else: + # Back out of transformation + self.shape = self.the_world.fox.shape def action_right(self): if self.facing != 'right':