Beispiel #1
0
    def playSounds(self):

        self.somyeol_count = len(self.game.level.somyeols)
        self.updateSoundsPlaying()

        #Sounds that are used by alot of Somyeols get a special treatment (walking and jumping)

        if jngl.keyDown(jngl.key.Up):
            #Stop other sounds if jumping
            for sound in Somyeol.Somyeol.sound_walk:
                jngl.stop(sound)
            for sound in Somyeol.Somyeol.sound_walk_crowd:
                jngl.stop(sound)

        #play other sounds...
        for sound in self.sound_queue:
            if sound in Somyeol.Somyeol.sound_walk:
                if self.walk_sounds_playing >= self.somyeol_count:
                    continue
            else:
                if self.sounds_playing >= self.somyeol_count:
                    continue
            if not sound in self.playing_sounds:
                jngl.play(sound)
            else:
                #use the crowd sounds
                if sound in Somyeol.Somyeol.sound_jump:
                    sound = Somyeol.Somyeol.sound_jump_crowd[random.randint(0,len(Somyeol.Somyeol.sound_jump_crowd)-1)]
                    if not jngl.isPlaying(sound):
                        jngl.play(sound)
                elif sound in Somyeol.Somyeol.sound_walk:
                    sound = Somyeol.Somyeol.sound_walk_crowd[random.randint(0,len(Somyeol.Somyeol.sound_walk_crowd)-1)]
                    if not jngl.isPlaying(sound):
                        jngl.play(sound)
        self.sound_queue.clear()
Beispiel #2
0
 def stopSounds(self):
     for sound in self.sounds:
         jngl.stop(sound)