'*** X-box hunting By Demoneye 2002

open window 640,512
label start
setrgb 0,0,0,0
clear screen
gosub setup
gosub loop

label setup
setrgb 1,255,255,255
text 210,200,"X-Box Shooting!"
text 180,300,"Press X to Continue"
repeat
pad=peek("port1")
until (and(pad,16384)>0)
x=320
y=256
time=60
speed=7
dx=0
dy=int(ran(320))+100
ammo=700
return

label loop
setdrawbuf dw
dw=1-dw
setdispbuf dw

setrgb 0,100,100,255
clear window
gosub background
gosub X_Box
gosub move_aim
sec=sec+1
if sec=60 then
sec=0
time=time-1
speed=speed+0.1
fi
if time<0 goto time_out
goto loop

label move_aim
pad=peek("port1")
if and(pad,16)>0 y=y-5
if and(pad,64)>0 y=y+5
if and(pad,32)>0 x=x+5
if and(pad,128)>0 x=x-5
if ammo>0 and and(pad,16384)>0 then
bul=1
ammo=ammo-1
setrgb 1,200,150,0
fill circle x,y,5
fi
setrgb 1,0,0,0
circle x,y,15
line x-20,y to x+20,y
line x,y-20 to x,y+20
if bul=1 and x<dx+10 and x>dx-10 and y>dy-10 and y<dy+10 then
dx=0:dy=int(ran(320))+100
score=score+1
fi
bul=0
return

label background
setrgb 1,0,200,0
setrgb 2,0,100,0
setrgb 3,0,100,0
gtriangle 640,512 to 640,420 to 0,420
setrgb 2,0,200,0
gtriangle 0,512 to 640,512 to 0,420
gtriangle 20,420 to 30,380 to 40,420
gtriangle 40,420 to 50,380 to 60,420
gtriangle 60,420 to 70,380 to 80,420
setrgb 1,50,30,30
setrgb 2,255,255,255
setrgb 3,50,30,30
gtriangle 350,420 to 450,270 to 550,420
setrgb 1,255,255,255
setrgb 2,100,100,255
setrgb 3,100,100,255
gtriangle 200,150 to 150,100 to 250,100
gtriangle 200,150 to 150,200 to 250,200
gtriangle 200,150 to 130,120 to 130,170
gtriangle 200,150 to 270,120 to 270,170
gtriangle 200,150 to 130,120 to 150,100
gtriangle 200,150 to 130,170 to 150,200
gtriangle 200,150 to 270,120 to 250,100
gtriangle 200,150 to 270,170 to 250,200
setrgb 1,0,0,0
rect 20,425 to 320,508
text 20,440,"You have shot "+str$(score)+" X-Boxs"
text 20,460,"You have missed "+str$(miss)+" X-Boxs"
text 20,480,"You have "+str$(time)+" seconds remaining"
text 20,500,"Ammo: "+str$(ammo)
if ammo<100 and ammo>0 then
text 200,20,"**A M M O  L O W!!**"
fi
if ammo<=0 then
ammo=0
text 160,20,"**A M M O  D E P L E T E D**"
fi
return

label X_Box
dx=dx+speed
dy=dy-1
if dx>640 then
dx=0:dy=int(ran(320))+100
miss=miss+1
fi
setrgb 1,100,100,100
fill rect dx-10,dy-10 to dx+10,dy+10
setrgb 1,50,50,50
line dx-10,dy-10 to dx+10,dy+10
line dx+10,dy-10 to dx-10,dy+10
setrgb 1,0,200,0
fill circle dx,dy,4
return

label time_out
repeat
setdrawbuf dw
dw=1-dw
setdispbuf dw
setrgb 0,0,0,0
clear window
setrgb 1,255,255,255
text 170,100,"You destroyed "+str$(score)+" X-Boxs"
text 170,200,"You missed "+str$(miss)+" X-Boxs"
if score<=miss then
text 170,300,"Too many got away!"
text 170,400,"Microsoft will dominate the industry!"
fi
if score>miss then
text 170,300,"They're goin' down!"
text 170,400,"Sony will prosper!"
fi
pad=peek("port1")
until (and(pad,16384)>0)
goto start
return

