Something like this.
backdrop off
REM USUAL SETTINGS
Sync on
Sync Rate 30
Hide mouse
Set display mode 800,600,32
Color backdrop rgb(0,0,0)
REM VARIABLES
score# = 0
milsec# = 40
lives = 3
`alot of these values depend on the size of your image
ShipPosX=380
ShipPosY=500
MaxLeft=10
MaxRight=700
`LOAD AND POSITION THE SHIP
Load image "sprites/ship.jpg", 1 , 1
sprite 1,ShipPosX,ShipPosY,1
`Turn backsave off
set sprite 1,0,1
`main loop
do
cls 0: ` if you decide to draw the screen each time through the loop
`very basic movement code
if rightkey()=1 and ShipPosX>MaxLeft
inc ShipPosX,4
endif
if leftkey()=1 and ShipPosX<MaxRight
dec ShipPosX,4
endif
`position sprite to new location
sprite 1,ShipPosX,ShipPosY,1
REM SCORE CODE
milsec# = milsec# - 1
If milsec# = 0 then
score# = score# + 20
if milsec# = 0 then milsec# = 40
REM PRINT SCORE AND LIVES
Set cursor 620,10
Print "Score ", score# ; " Lives ", lives
If lives = 0 then goto gameover
sync
loop
gameover:
Set Cursor 400,300
Print "GAME OVER"
Wait 3000
End
~zen