So far I haven’t gotten to the transition part. What I am working on now is trying to get the pygame to play different soundtracks for different portions of the game. So far, I haven’t gotten it to loop - here is what I have done.
1. Created a global empty to manage looping. In its logic bricks I have an always check that calls this code:
import GameLogic as g
import pygame.mixer
c = g.getCurrentController()
o = c.getOwner()
pygame.mixer.init()
o.IsPlaying = pygame.mixer.music.get_busy()
It also has a Property Changed block that looks for changes to the IsPlaying property:
import GameLogic as g
import pygame.mixer
c = g.getCurrentController()
o = c.getOwner()
if o.IsPlaying != IsPositive:
pygame.mixer.music.play()
2. Created Empties for each soundtrack sections, that the player will pass near. This empty has one Near sensor that will load the song for that section of the game:
import GameLogic as g
import pygame.mixer
c = g.getCurrentController()
o = c.getOwner()
if o.Init == 1:
pygame.mixer.music.load('EntryRoomST.mp3')
pygame.mixer.music.play()
o.Init = 0
The initial soundtrack is triggered once (which is good, at first it was triggering over and over), but it does not loop and, I’m not sure if the different sections will load their mp3s properly (I will work on that once it is looping properly). THEN, once I have the sections looping and loading properly, I will work on trying to smooth up their transitions. I’ll look at your sample tonight. Thanks for posting it!!!
-invid