Changeset 213:07b361ebd87f


Ignore:
Timestamp:
Sep 4, 2009, 9:49:32 PM (11 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
Convert:
svn:b4e93282-eac8-4b8b-b765-0f5d36de2b68@214
Message:

Ensure we clean up highlights, etc.

Location:
gamelib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gamelib/engine.py

    r203 r213  
    121121            return NightState(self.game)
    122122        elif e.type is KEYDOWN and e.key == K_ESCAPE:
    123             self.game.gameboard.set_cursor()
     123            self.game.gameboard.reset_states()
    124124            return GameOver(self.game)
    125125        elif e.type is ANIM_ID:
     
    149149        sound.stop_background_music()
    150150        self.game.gameboard.tv.sun(False)
    151         self.game.gameboard.set_cursor()
     151        self.game.gameboard.reset_states()
    152152
    153153        sound.play_sound("nightfall.ogg")
  • gamelib/gameboard.py

    r212 r213  
    250250    def set_selected_tool(self, tool, cursor):
    251251        self.selected_tool = tool
     252        if self.animal_to_place:
     253            # Clear any highlights
     254            self.animal_to_place.unequip_by_name("spotlight")
    252255        self.select_animal_to_place(None)
    253256        sprite_curs = None
     
    267270            self.sprite_cursor = sprite_curs
    268271            self.tv.sprites.append(self.sprite_cursor)
    269            
     272
     273    def reset_states(self):
     274        """Clear current states (highlights, etc.)"""
     275        if self.animal_to_place:
     276            self.animal_to_place.unequip_by_name("spotlight")
     277        self.set_cursor()
    270278
    271279    def update_sprite_cursor(self, e):
Note: See TracChangeset for help on using the changeset viewer.