Changeset 353:3ac03073218f


Ignore:
Timestamp:
04/09/11 11:56:48 (12 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
Phase:
public
Rebase:
66393835633235656132316232623961613164623539373633626531313239636333333135613761
Message:

Don't allow tranformations if they'll get us stuck

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/sprites/player.py

    r348 r353  
    6969        # We always allow the attacking animation frames
    7070        if not self.check_collide_rect(cand_collide_rect, cand_rect, cand_image) and not self.attacking:
    71             return
     71            return False
    7272        self.image = cand_image
    7373        self.collide_rect = cand_collide_rect
     
    7575        self.rect_offset = cand_rect_offset
    7676        self.init_pos()
     77        return True
    7778
    7879    def update(self):
     
    226227            # Become human
    227228            if self.the_world.fox.has_fan:
    228                 self.the_world.fox.shape = 'human_with_fan'
     229                self.shape = 'human_with_fan'
    229230            else:
    230                 self.the_world.fox.shape = 'human'
    231         else:
    232             self.the_world.fox.shape = 'fox'
    233         self.shape = self.the_world.fox.shape
     231                self.shape = 'human'
     232        else:
     233            self.shape = 'fox'
     234        # Check the transformation is feasible
     235        if self.set_image():
     236            # Transformation succeeded
     237            self.the_world.fox.shape = self.shape
     238        else:
     239            # Back out of transformation
     240            self.shape = self.the_world.fox.shape
    234241
    235242    def action_right(self):
Note: See TracChangeset for help on using the changeset viewer.