Show
Ignore:
Timestamp:
01/05/07 02:21:51 (5 years ago)
Author:
mg
Message:

Another sound effect: bouncing off something.

Add sound effects to the set of distributed files in setup.py

Files:
1 modified

Legend:

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

    r236 r237  
    19721972        self.fire_sound = pygame.mixer.Sound(find('sounds', 
    19731973                                                  'Gun_Silencer.wav')) 
     1974        self.bounce_sound = pygame.mixer.Sound(find('sounds', 
     1975                                                    'electricshock.wav')) 
    19741976 
    19751977    def _init_fonts(self): 
     
    19992001                             rng=self.rng) 
    20002002        self.ships = self.game.ships 
     2003        for ship in self.ships: 
     2004            ship.bounce_effect = self.bounce_effect_Ship 
    20012005        self.ai = map(AIController, self.ships) 
    20022006        self.ai_controlled = [False] * len(self.ships) 
     
    22532257            self.fire_sound.play() 
    22542258 
     2259    def bounce_effect_Ship(self, ship, obstacle): 
     2260        """Play a sound effect when the player's ship bounces off something.""" 
     2261        player_id = self.ships.index(ship) 
     2262        if not self.ai_controlled[player_id]: 
     2263            self.bounce_sound.play() 
     2264 
    22552265    def draw(self): 
    22562266        """Draw the state of the game""" 
     
    24452455            self.update_missile_trails() 
    24462456            self.framedrop_needed = not self.game.wait_for_tick() 
    2447