starfield()
drawplayer()
meteorites(a)
rules()
if bullettime=2 'and spaceup=true
repeat
q=random(0,29)
until bexists[q]=false
bexists[q]=true
bx[q]=shipx
by[q]=shipy
spaceup=false
bullettime=0
end if
if not bullettime=5 then spaceup=true and bullettime=0

draw frame
wend
procedure starfield()

set pen colour black
paint canvas
if init =true
for i = 0 to 50
bgx=random (0,800)
bgy=random(0,600)
next
for o = 0 to 40
bgx2[o]=random (0,800)
bgy2[o]=random(0,600)
next
for u = 0 to 30
bgx3=random (0,800)
bgy3=random(0,600)
next
for y = 0 to 10
bgx4[y]=random (0,800)
bgy4[y]=random(0,600)
next
init=false
end if
for n=0 to 50
set pen colour blue
fill rect bgx[n]-1,bgy[n]-1 to bgx[n]+3,bgy[n]+3
set pen colour white
fill rect bgx[n],bgy[n] to bgx[n]+2,bgy[n]+2
bgx[n]=bgx[n]-8
if bgx[n]<0 then bgx[n]=810
next
for m=0 to 40
set pen colour blue
fill rect bgx2[m]-1,bgy2[m]-1 to bgx2[m]+4,bgy2[m]+4
set pen colour white
fill rect bgx2[m],bgy2[m] to bgx2[m]+3,bgy2[m]+3
bgx2[m]=bgx2[m]-12
if bgx2[m]<0 then bgx2[m]=810
next
for v=0 to 10
set pen colour blue
fill rect bgx4[v]-1,bgy4[v]-1 to bgx4[v]+6,bgy4[v]+6
set pen colour white
fill rect bgx4[v],bgy4[v] to bgx4[v]+5,bgy4[v]+5
bgx4[v]=bgx4[v]-25
if bgx4[v]<0 then bgx4[v]=810
next
for b=0 to 30
set pen colour blue
fill rect bgx3-1,bgy3-1 to bgx3+5,bgy3+5
set pen colour white
fill rect bgx3,bgy3 to bgx3+4,bgy3+4
bgx3=bgx3-16
if bgx3<0 then bgx3=810
next
end proc
procedure drawplayer()
sprite 100,shipx,shipy,0
shipx=mouse x
shipy=mouse y
'if up
' shipy=shipy-speed
'end if
'if down
'shipy=shipy+speed
'end if
'if left
'shipx=shipx-speed
'end if
'if right
'shipx=shipx+speed
'end if
if shipy>=590 then shipy=590
if shipy<10 then shipy=10
if shipx>=775 then shipx=775
if shipx<26 then shipx=25
end proc
procedure meteorites(int num)
time=time+1
if time =4
repeat
loop=random( 0 , 19)
until mexists[loop]=false
mexists[loop]=true
mx[loop]=850
my[loop]=random(0,700)
men[loop]=random(5 , 20)
time=0
end if
for loop2=0 to 19

if mexists[loop2]=true
mx[loop2]=mx[loop2]-25
sprite loop2,mx[loop2],my[loop2],2
if mx[loop2]<=-100
sprite off loop2
mexists[loop2]=false
end if
end if

for a=0 to 29

if bexists[a]=true
bx[a]=bx[a]+1
sprite a+50,bx[a],by[a]-15,1
if bx[a]>800
sprite off a
bexists[a]=false
end if
end if
if sprite col(a+50,loop2)=loop2
points=points+10
bexists[a]=false
sprite off a+50
men[loop2]=men[loop2]-1
if men[loop2]=0
''play sound(0)
mexists[loop2]=false
sprite off loop2
points=points+50
end if

end if
next

if sprite col (100,loop2)=loop2
lives=lives-1
'play sound(1)
mexists[loop2]=false
sprite off loop2
end if