Hrm odd.. hehe oh well.. here is the code again
`Set screen mode and refresh rate
Set display mode 1024,768,32
sync rate 60
sync on
`Set background colour
ink rgb(244,214,210),0
`Set initial variables
hide mouse
shipx = screen width() / 2
shipy = screen height() - (screen height() / 10)
speed = 3
starmove = speed
enemychance = 100
`Set initial arrays
DIM shot(20,5)
DIM xtop(100)
DIM ytop(100)
DIM xmid(100)
DIM ymid(100)
DIM xbot(100)
DIM ybot(100)
DIM enemy(20,10)
`Setup initial star points
for star = 1 to 50
xtop(star) = rnd(1024)
xmid(star) = rnd(1024)
xbot(star) = rnd(1024)
ytop(star) = rnd(768)
ymid(star) = rnd(768)
ybot(star) = rnd(768)
next star
`Start main loop
do
`Clear screen
cls
`Movement input detection
if keystate(17) then dec shipy, speed
if keystate(31) then inc shipy, speed
if keystate(30) then dec shipx, speed
if keystate(32) then inc shipx, speed
print enem
print enemyappear
`Detect mouse input for target and firing
targetx = mousex()
targety = mousey()
`Calculate if enemy wave arrives
enemyappear = rnd(enemychance)
if enemyappear = 0 and enem < 20 then enem = enem + 1:gosub createenemy
`Check for firing
if mouseclick() = 1 and b < 20 and wpause < (timer() - 100)
wpause = timer()
inc b
shot(b,1) = shipx
shot(b,2) = shipy-30
shot(b,3) = 6
endif
`Calculate firing
ink rgb(244,10,10),0
for shotcalc = 1 to b
dot shot(shotcalc,1),shot(shotcalc,2)
shot(shotcalc,2) = shot(shotcalc,2) - shot(shotcalc,3)
if shot(shotcalc,2) < 0 then gosub firereset
next shotcalc
`Calculate star positions and display stars
for star = 1 to 50
ytop(star) = ytop(star) + starmove * 3
ymid(star) = ymid(star) + starmove * 2
ybot(star) = ybot(star) + starmove
if ytop(star) > 768 then ytop(star) = 0:xtop(star) = rnd(1024)
if ymid(star) > 768 then ymid(star) = 0:xmid(star) = rnd(1024)
if ybot(star) > 768 then ybot(star) = 0:xbot(star) = rnd(1024)
ink rgb(244,244,244),0
dot xtop(star), ytop(star)
ink rgb(144,144,144),0
dot xmid(star), ymid(star)
ink rgb(44,44,44),0
dot xbot(star), ybot(star)
next star
`Display main ship
ink rgb(244,214,210),0
line shipx -10,shipy, shipx +10, shipy
line shipx-10,shipy,shipx, shipy-30
line shipx+10,shipy,shipx, shipy-30
`Display enemy ship
ink rgb(10,244,10),0
for ecount = 1 to enem
circle enemy(ecount,1), enemy(ecount,2), 5
emove = rnd(8)
if emove = 0 then enemy(ecount,1) = enemy(ecount,1) - 3
if emove = 1 then enemy(ecount,1) = enemy(ecount,1) + 3
enemy(ecount,2) = enemy(ecount,2) + 2
if enemy(ecount,2) > 768 then gosub ereset
next ecount
`Display targeter
ink rgb(244,10,10),0
line targetx-5,targety, targetx-10, targety
line targetx+5,targety, targetx+10, targety
line targetx,targety-5, targetx, targety-10
line targetx,targety+5, targetx, targety+10
`Sync screen
sync
`Repeat loop
loop
`Create enemy to display
createenemy:
enemy(enem,1) = rnd(1024)
enemy(enem,2) = 0
enemy(enem,3) = rnd(10)
return
`Reset array if enemy leaves screen
ereset:
for reset = ecount to (enem-1)
enemy(reset, 1) = enemy(reset+1, 1)
enemy(reset, 2) = enemy(reset+1, 2)
enemy(reset, 3) = enemy(reset+1, 3)
next reset
dec enem
return
`Reset array if projectile leaves screen
firereset:
for reset = shotcalc to (b-1)
shot(reset, 1) = shot(reset+1, 1)
shot(reset, 2) = shot(reset+1, 2)
next reset
dec b
return