Changeset 245

Show
Ignore:
Timestamp:
01/05/07 03:25:05 (5 years ago)
Author:
mg
Message:

Change the way missile launch sound effects work, to be more like the others.
Fixes a bug where you would hear launch sounds when you pressed the fire key
while your ship was dead.

Location:
trunk/src/pyspacewar
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/pyspacewar/ui.py

    r244 r245  
    20112011        self.ships = self.game.ships 
    20122012        for ship in self.ships: 
     2013            ship.launch_effect = self.launch_effect_Ship 
    20132014            ship.bounce_effect = self.bounce_effect_Ship 
    20142015            ship.hit_effect = self.hit_effect_Ship 
     
    22702271        if not self.ai_controlled[player_id]: 
    22712272            self.ships[player_id].launch() 
     2273 
     2274    def launch_effect_Ship(self, ship, obstacle): 
     2275        """Play a sound effect when the player's ship bounces off something.""" 
     2276        player_id = self.ships.index(ship) 
     2277        if not self.ai_controlled[player_id]: 
    22722278            self.fire_sound.play() 
    22732279 
  • trunk/src/pyspacewar/world.py

    r241 r245  
    556556        self.dead = False 
    557557        self.spawn_time = 0 # the value of world.time when last respawned 
     558        self.launch_effect = None 
    558559        self.hit_effect = None 
    559560        self.explode_effect = None 
     
    689690        self.velocity -= recoil 
    690691        self.world.add(missile) 
     692        if self.launch_effect: 
     693            self.launch_effect(self, missile) 
    691694 
    692695