Wait for music is finishing to play - SOLVED
Hi !
My purpose atm is to load "intro picture", "intro music" and "menu" assests, then wait for "intro music" to stop playing and go to the next step - menu dialog. I do it this way ( gamestage variable is global and contains information on where we are ) with Gameview and MediaPlayer for audio:
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
'Init timer
GameTimer.Initialize( "GameTimer", 30)
' Load and play intro music
IntroMusic.Initialize
IntroMusic.Load(File.DirAssets, "intro.ogg")
IntroMusic.SetVolume(0.5,0.5)
IntroMusic.Play
' Load Intro screen
IntroPicture.Bitmap = LoadBitmap(File.DirAssets, "company-logo.jpg")
IntroPicture.DestRect.Initialize( 0%x, 0%y, 100%x, 100%y )
' Init Game view and display Company logo picture
gv.Initialize("gv")
Activity.AddView(gv, 0, 0, 100%x, 100%y)
gv.BitmapsData.Add( IntroPicture )
' Load menu music
MenuMusic.Initialize
MenuMusic.Load(File.DirAssets, "menu.ogg")
MenuMusic.SetVolume( 1.0, 1.0 )
' Load Menu pictures
MenuPicture.Bitmap = LoadBitmap(File.DirAssets, "menu.jpg")
MenuPicture.DestRect.Initialize( 0%x, 0%y, 100%x, 100%y )
gamestage = 1
End If
' game Logic, depending on Gamestage variable
Select gamestage
Case 1
' Wait until music is stop
If IntroMusic.IsPlaying = 0 Then
gamestage = 2
'Show Menu
IntroMusic.Stop
MenuMusic.Play
gv.BitmapsData.Add( MenuPicture )
gv.Invalidate
End If
Case 2
' Menu stuff here
End Select
End Sub
Programm installs Ok on to the device, but i got this message:
Programm paused on line: line number
If IntroMusic.IsPlaying = 0 Then
This message is always on screen ever when "intro music" is stop
So, what i'm doing wrong ? Or may be all is wrong here ?
Thank you