Пример #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()
Пример #2
0
 def updateSoundsPlaying(self):
     self.sounds_playing = 0
     self.walk_sounds_playing = 0
     self.playing_sounds = []
     for sound in self.sounds:
         if jngl.isPlaying(sound):
             self.playing_sounds.append(sound)
             if sound in Somyeol.Somyeol.sound_walk:
                 self.walk_sounds_playing += 1
             else:
                 self.sounds_playing +=1
Пример #3
0
 def checkMusic(self):
     if not jngl.isPlaying(self.music[self.currentTrack]):
         self.currentTrack = (self.currentTrack + 1) % len(self.music)
         jngl.play(self.music[self.currentTrack])