I have begun my first application with DBP, though thus far the differences between it and DBC are minimal, and I am seeking some help with just how to approach firing within this code:
sync on: sync rate 30
Hide mouse
set image colorkey 255,0,255
Load image "cursor.bmp",1
Load image "Ship.bmp",2
Load image "laser.bmp",3
pcx# = 320
pcy# = 440
Do
cls
sprite 1,mousex()-16,mousey()-16,1
If Button(20,55,"New Game") = 1 then goto New_Game
Button(20,95,"Load Game")
If Button(20,135,"Exit") = 1 then end
sync
loop
New_Game:
delete sprite 1
cls
Repeat
cls
Text 240,220,"Get Ready to Play";
sync
Until returnkey() = 1
goto Game_Play
Game_Play:
Do
cls
sprite 2,pcx#,pcy#,2
gosub ship_controls
gosub ship_firing
sync
loop
ship_controls:
if leftkey() = 1 then pcx# = (pcx# - 4)
if pcx# < 6 then pcx# = 6
if rightkey() = 1 then pcx# = (pcx# + 4)
if pcx# > 608 then pcx# = 608
return
Function Button(x1,y1,Words$)
x2 = text width(Words$)
y2 = text height(Words$)/2
Rem check mouse location
if mousex()>x1 and mousex()<x1+x2
if mousey()>y1-y2 and mousey()<y1+y2
pressed = 1
endif
endif
if pressed = 1 then ink rgb(255,0,0),0 else ink rgb(255,255,255),0
if pressed = 1
pressed = mouseclick()
else
pressed = 0
endif
text x1,y1,Words$
endfunction pressed
I disagree.