Handle background music
This commit is contained in:
parent
2a633da757
commit
a6f3e9a3e2
2 changed files with 13 additions and 5 deletions
|
@ -28,10 +28,7 @@ Global GFXLogo.i
|
||||||
Global GFXTileset.i
|
Global GFXTileset.i
|
||||||
|
|
||||||
; Sounds
|
; Sounds
|
||||||
|
Global MenuSoundStarted = 0
|
||||||
LoadSound(0, #DATA_PATH + "sound/menu_change.wav")
|
LoadSound(0, #DATA_PATH + "sound/menu_change.wav")
|
||||||
LoadSound(1, #DATA_PATH + "sound/menu_select.wav")
|
LoadSound(1, #DATA_PATH + "sound/menu_select.wav")
|
||||||
|
LoadSound(2, #DATA_PATH + "sound/title_song.wav")
|
||||||
; Images
|
|
||||||
UseJPEGImageDecoder()
|
|
||||||
Debug LoadImage(#Tile01, #DATA_PATH+"gfx/tileset01.jpg")
|
|
||||||
|
|
||||||
|
|
11
src/Main.pb
11
src/Main.pb
|
@ -83,6 +83,17 @@ If OpenWindow(0, 0, 0, Screen\Width, Screen\Height, title, #PB_Window_ScreenCent
|
||||||
Define Event = WindowEvent()
|
Define Event = WindowEvent()
|
||||||
Until Event = 0
|
Until Event = 0
|
||||||
|
|
||||||
|
; Handle the background music
|
||||||
|
If CurrentState = "MAIN_MENU" Or CurrentState = "RLY_QUIT"
|
||||||
|
If MenuSoundStarted = 0
|
||||||
|
MenuSoundStarted = PlaySound(2, #PB_Sound_MultiChannel|#PB_Sound_Loop)
|
||||||
|
SoundVolume(2, 70, MenuSoundStarted)
|
||||||
|
EndIf
|
||||||
|
Else
|
||||||
|
StopSound(2, MenuSoundStarted)
|
||||||
|
MenuSoundStarted = 0
|
||||||
|
EndIf
|
||||||
|
|
||||||
; Handle global events
|
; Handle global events
|
||||||
ExamineKeyboard()
|
ExamineKeyboard()
|
||||||
If KeyboardReleased(#PB_Key_F)
|
If KeyboardReleased(#PB_Key_F)
|
||||||
|
|
Loading…
Reference in a new issue