Well, currently i'm working on a Space Invaders type game, to test myself out on what i've learnt in DBP so far, and i've run into a problem. Basically, what I want it to do is when the user clicks the "New Game" button on the main menu, they're taken to the main game area, where the game is actually played. Then, when the player gets to the main area, a countdown starts, and a sound plays for each number of the countdown, so it goes:
3! (Play sound of voice saying 3)
2! (Play sound of voice saying 2)
1! (Play sound of voice saying 1)
Go! (Play sound of voice saying Go)
And when Go! is said, the game starts. I've gotten my code to go 3, 2, but it won't show the number 1 and it won't play the sound either. What's wrong? Attached is the media for the voices and below is my code.
REM Project: My First Game - Space Invaders
REM Created: 11-Apr-07 2:07:36 PM
REM
REM ***** Main Source File *****
REM GOTOS
GOSUB var_dec
var_dec:
plr_lives=3
enemy_hp=20
score=0
tmr#=1
vary=0
resolution=1
resx=800
resy=600
GOTO main_menu
main_menu:
SET DISPLAY MODE resx, resy, 32
forground = RGB(255,255,255)
background = RGB(0,0,0)
BACKDROP OFF
SYNC OFF
INK 0,0
CLS
MakeABackground(resx,resy)
MakeMenuButtons()
DO
INK forground,background
PASTE IMAGE 1,0,0
SPRITE 1,resx/2,650,1
LOOP
END
FUNCTION MakeABackground(resx,resy)
LOAD IMAGE "mediammbg.png",1
PASTE IMAGE 1,0,0
ENDFUNCTION
FUNCTION MakeMenuButtons()
INK RGB(255,0,0),0
BOX 350,350,450,370
INK 0,0
BOX 351,351,449,369
INK RGB(255,255,255),0
TEXT 385,352,"Exit"
SET TEXT OPAQUE
SET TEXT TO NORMAL
INK RGB(255,0,0),0
BOX 300,300,400,320
INK 0,0
BOX 301,301,399,319
INK RGB(255,255,255),0
TEXT 315,302,"Load Game"
SET TEXT OPAQUE
SET TEXT TO NORMAL
INK RGB(255,0,0),0
BOX 200,200,300,220
INK 0,0
BOX 201,201,299,219
INK RGB(255,255,255),0
TEXT 215,202,"New Game"
SET TEXT OPAQUE
DO
Mx=MOUSEX(): My=MOUSEY(): Mc=MOUSECLICK()
IF Mx>350 AND My>350 AND Mx<450 AND My<370
If Mc=1
END
ELSE
ENDIF
ELSE
ENDIF
Mx=MOUSEX(): My=MOUSEY(): Mc=MOUSECLICK()
IF Mx>300 AND My>300 AND Mx<400 AND My<320
If Mc=1
GOSUB load_game
ELSE
ENDIF
ELSE
ENDIF
Mx=MOUSEX(): My=MOUSEY(): Mc=MOUSECLICK()
IF Mx>200 AND My>200 AND Mx<300 AND My<220
If Mc=1
GOSUB new_game:
ELSE
ENDIF
ELSE
ENDIF
LOOP
ENDFUNCTION
RETURN
load_game:
` Load the game from a .DAT file here
RETURN
new_game:
CLS
LOAD IMAGE "mediabackdrop.png",2
PASTE IMAGE 2,0,0
LOAD IMAGE "mediaplayer.bmp",3
PASTE IMAGE 3,200,500
LOAD SOUND "mediathree.wav",3
LOAD SOUND "mediatwo.wav",4
LOAD SOUND "mediaone.wav",5
LOAD SOUND "mediago.wav",6
TEXT 0,0,"Score: "+str$(score)
TEXT 0,20,"Lives: "+str$(plr_lives)
SLEEP 1000
SET TEXT FONT "Fixedsys"
SET TEXT SIZE 36
TEXT resx/2,resy/2,"3" : PLAY SOUND 3
DO
INC tmr#,1
IF tmr#>240
GOTO two:
ENDIF
IF tmr#>500
GOTO oner
ENDIF
SET TEXT FONT "Fixedsys"
SET TEXT SIZE 36
LOOP
RETURN
two:
TEXT resx/2,resy/2,"2"
PLAY SOUND 4
RETURN
oner:
TEXT resx/2,resy/2,"One"
PLAY SOUND 5
RETURN
play_game:
` Temporary Code
SET CURSOR 0,0
SET TEXT FONT "Arial"
SET TEXT SIZE 1
TEXT 0,0,"HELLO"
` End Temporary Code
RETURN
All help is appreciated, thanks!