set display mode 1024,768,32
`load sounds
`load sound "colt45.wav",1
`camera stuff
set camera range 1,99999
position camera 0,0,-2000
color backdrop 0
`make human player and stuff
make object sphere 1,450,50,50
position object 1,2300,-1200,4500
color object 1,rgb(255,0,0)
ghost object on 1
`make weapon
`load object "thompson.x",12
make object cube 12,600
`yrotate object 12,-90
scale object 12,100,10,10
position object 12,2000,-1350,4250
`make bullet
make object sphere 11,40
position object 11,2300,-1200,4500
color object 11,rgb(227,189,55)
ghost object on 11
hide object 11
`make shield
make object sphere 13,900,50,50
scale object 13,168,130,120
position object 13,2300,-1200,4500
color object 13,rgb(192,192,192)
ghost object on 13
hide object 13
`make rocket
make object cone 50,200
zrotate object 50,90
scale object 50,80,150,80
position object 50,1700,1200,4500
color object 50,rgb(0,0,255)
ghost object on 50
hide object 50
`make health and energy bar
make object cube 14,200
scale object 14,1400,60,.001
position object 14,3700,300,4500
color object 14,rgb(255,0,0)
ghost object on 14
make object cube 15,200
scale object 15,1400,60,.001
position object 15,3700,100,4500
color object 15,rgb(0,0,255)
ghost object on 15
`menu stuff
`make menu background
make object cube 16,700
scale object 16,420,620,.1
position object 16,0,-3000,4500
ink 0,0
box 0,0,2,10:box 0,0,10,2:box 8,0,10,10:box 0,8,10,10
ink rgb(255,0,0),0
box 2,2,8,8
get image 1,0,0,10,10
texture object 16,1
ghost object on 16
`make buttons
`these are for the main menu
make object sphere 17,600
scale object 17,200,70,1
position object 17,0,-2300,4490
color object 17,rgb(0,155,0)
make object sphere 18,600
scale object 18,200,70,1
position object 18,0,-2750,4490
color object 18,rgb(0,155,0)
make object sphere 19,600
scale object 19,200,70,1
position object 19,0,-3200,4490
color object 19,rgb(0,155,0)
make object sphere 20,600
scale object 20,200,70,1
position object 20,0,-3650,4490
color object 20,rgb(0,155,0)
`these are for the power buttons
make object sphere 21,600
scale object 21,200,70,1
position object 21,1500,-2300,4490
color object 21,rgb(0,155,0)
make object sphere 22,600
scale object 22,200,70,1
position object 22,1500,-2750,4490
color object 22,rgb(0,155,0)
make object sphere 23,600
scale object 23,200,70,1
position object 23,1500,-3200,4490
color object 23,rgb(0,155,0)
make object sphere 24,600
scale object 24,200,70,1
position object 24,1500,-3650,4490
color object 24,rgb(0,155,0)
hide object 21:hide object 22:hide object 23:hide object 24
`these are for the attack power buttons
make object sphere 25,600
scale object 25,200,70,1
position object 25,3000,-2300,4490
color object 25,rgb(0,155,0)
make object sphere 26,600
scale object 26,200,70,1
position object 26,3020,-2750,4490
color object 26,rgb(0,155,0)
make object sphere 27,600
scale object 27,200,70,1
position object 27,3040,-3200,4490
color object 27,rgb(0,155,0)
make object sphere 28,600
scale object 28,200,70,1
position object 28,3060,-3650,4490
color object 28,rgb(0,155,0)
hide object 25:hide object 26:hide object 27:hide object 28
`these are for the defense power buttons
make object sphere 29,600
scale object 29,200,70,1
position object 29,3000,-2300,4490
color object 29,rgb(0,155,0)
make object sphere 30,600
scale object 30,200,70,1
position object 30,3000,-2750,4490
color object 30,rgb(0,155,0)
make object sphere 31,600
scale object 31,200,70,1
position object 31,3000,-3200,4490
color object 31,rgb(0,155,0)
make object sphere 32,600
scale object 32,200,70,1
position object 32,3000,-3650,4490
color object 32,rgb(0,155,0)
hide object 29:hide object 30:hide object 31:hide object 32
 
`make computer player and stuff
make object sphere 100,450,50,50
position object 100,-2300,-1200,4500
color object 100,rgb(0,0,255)
ghost object on 100
`make weapon
clone object 112,12
`yrotate object 112,90
scale object 112,100,10,10
position object 112,-2000,-1350,4250
`make bullet
make object sphere 111,40
position object 111,-2300,-1200,4500
color object 111,rgb(227,189,55)
ghost object on 111
hide object 111
`make shield
make object sphere 113,900,50,50
scale object 113,168,130,120
position object 113,-2300,-1200,4500
color object 113,rgb(192,192,192)
ghost object on 113
hide object 113
`more camera stuff
autocam off
`set up some global variables and identify them
global power
global comppower
global humanturn
global compturn
global humguny
global compguny
global humgunx
global compgunx
comppower=1
power=1
humanturn=1
compturn=0
humguny=-1350
compguny=-1350
humgunx=2000
compgunx=-2000
`the main battle loop
do
`these are for the powerups
gosub comppowerup
gosub powerup
`this is to keep the guns moving up and down
gosub gunmovecomp
gosub gunmovehum
`this controls the humans turn
if humanturn=1
gosub attack
gosub shield
gosub kick
gosub buttons
endif
`this controls computers turn
if compturn=1
gosub compattack
gosub buttons
gosub compshield
gosub compkick
endif
loop
 
attack:
if clickedatt=1 and humattack=0 then humattack=1:humbullet=1700:show object 11:hide object 13:gunkick=1
if humattack=1
position object 11,humbullet,object position y(12)+150,4500
dec humbullet,100
if humbullet=-2200 then hide object 11:humattack=0:clickedatt=0:compturn=1:humanturn=0
endif
return
 
kick:
if gunkick=1
position object 12,humgunx,object position y(12),4250
if humkick=0 then inc humgunx,50
if humkick=1 then dec humgunx,10
if humgunx=2200 then humkick=1
if humgunx=2000 then gunkick=0:humkick=0
endif
return
 
shield:
if clickedshield=1 then show object 13:humanturn=0:compturn=1:clickedshield=0
return
 
gunmovehum:
position object 12,2000,humguny,4250
inc hummove
if hummove=11 then hummove=0
if hummove=10
if humdown=0 then inc humguny
if humguny=-1300 then humdown=1
if humdown=1 then dec humguny
if humguny=-1350 then humdown=0
endif
return
 
powerup:
if shiftkey()=1 then humsuper=1
if power>1
if object exist(2)=0 then make object sphere 2,200,50,50:color object 2,rgb(0,255,0):position object 2,0,0,4500:ghost object on 2
human2x=360*sin(humrotate2#-100)
human2z=180*cos(humrotate2#-100)
position object 2,human2x+2300,-1100,human2z+4500
inc humrotate2#:if humsuper=1 then inc humrotate2#,10
endif
if power>2
if object exist(3)=0 then make object sphere 3,200,50,50:color object 3,rgb(0,255,0):position object 3,0,0,4500:ghost object on 3
human3x=360*sin(humrotate3#-100)
human3z=180*cos(humrotate3#-100)
position object 3,human3x+2300,-1300,human3z+4500
inc humrotate3#:if humsuper=1 then inc humrotate3#,10
endif
if power>3
if object exist(4)=0 then make object sphere 4,200,50,50:color object 4,rgb(0,255,0):position object 4,0,0,4500:ghost object on 4
human4x=360*sin(humrotate4#-100)
human4z=180*cos(humrotate4#-100)
position object 4,human4x+2300,-1200,human4z+4500
inc humrotate4#:if humsuper=1 then inc humrotate4#,10
endif
if power>4
if object exist(5)=0 then make object sphere 5,200,50,50:color object 5,rgb(0,255,0):position object 5,0,0,4500:ghost object on 5
human5x=180*sin(humrotate5#-100)
human5z=180*cos(humrotate5#-100)
human5y=360*sin(humrotate5#-100)
position object 5,human5x+2300,human5y-1200,human5z+4500
inc humrotate5#:if humsuper=1 then inc humrotate5#,10
endif
if power>5
if object exist(6)=0 then make object sphere 6,200,50,50:color object 6,rgb(0,255,0):position object 6,0,0,4500:ghost object on 6
human6x=180*sin(humrotate6#-300)
human6z=180*cos(humrotate6#-100)
human6y=360*sin(humrotate6#-100)
position object 6,human6x+2300,human6y-1200,human6z+4500
inc humrotate6#:if humsuper=1 then inc humrotate6#,10
endif
if power>6
if object exist(7)=0 then make object sphere 7,200,50,50:color object 7,rgb(255,0,255):position object 7,0,0,4500:ghost object on 7
human7x=400*sin(humrotate7#-100)
human7z=100*cos(humrotate7#-100)
position object 7,human7x+2300,-900,human7z+4500
inc humrotate7#,4:if humsuper=1 then inc humrotate7#,10
endif
if power>7
if object exist(8)=0 then make object sphere 8,200,50,50:color object 8,rgb(255,0,255):position object 8,0,0,4500:ghost object on 8
human8x=400*sin(humrotate8#-100)
human8z=100*cos(humrotate8#-100)
position object 8,human8x+2300,-1500,human8z+4500
inc humrotate8#,4:if humsuper=1 then inc humrotate8#,10
endif
if power>8
if object exist(9)=0 then make object sphere 9,200,50,50:color object 9,rgb(255,0,255):position object 9,0,0,4500:ghost object on 9
human9y=400*sin(humrotate9#-100)
human9z=100*cos(humrotate9#-100)
position object 9,2000,human9y-1200,human7z+4500
inc humrotate9#,4:if humsuper=1 then inc humrotate9#,10
endif
if power>9
if object exist(10)=0 then make object sphere 10,200,50,50:color object 10,rgb(255,0,255):position object 10,0,0,4500:ghost object on 10
human10y=400*sin(humrotate10#-100)
human10z=100*cos(humrotate10#-100)
position object 10,2600,human10y-1200,human10z+4500
inc humrotate10#,4:if humsuper=1 then inc humrotate10#,10
endif
return
 
compattack:
if returnkey()=1 and compattack=0 then compattack=1:compbullet=-1700:show object 111:compgunkick=1:kickcomp=0
if compattack=1
position object 111,compbullet,object position y(112)+150,4500
inc compbullet,100
if compbullet=2200 then hide object 111:compattack=0::humanturn=1:compturn=0:hide object 13
endif
return
 
compkick:
if compgunkick=1
position object 112,compgunx,object position y(112),4250
if kickcomp=0 then dec compgunx,50
if kickcomp=1 then inc compgunx,10
if compgunx=-2200 then kickcomp=1
if compgunx=-2000 then compgunkick=0:kickcomp=0
endif
return
 
compshield:
if compshield=1 then show object 113
return
 
gunmovecomp:
position object 112,-2000,compguny,4250
inc compmove
if compmove=11 then compmove=0
if compmove=10
if compdown=0 then inc compguny
if compguny=-1300 then compdown=1
if compdown=1 then dec compguny
if compguny=-1350 then compdown=0
endif
return
 
comppowerup:
if controlkey()=1 then inc comppower:sleep 200
if shiftkey()=1 then compsuper=1
if comppower>1
if object exist(102)=0 then make object sphere 102,200,50,50:color object 102,rgb(0,255,0):position object 102,0,0,4500:ghost object on 102
comp2x=360*sin(comprotate2#-100)
comp2z=180*cos(comprotate2#-100)
position object 102,comp2x-2300,-1100,comp2z+4500
inc comprotate2#:if compsuper=1 then inc comprotate2#,10
endif
if comppower>2
if object exist(103)=0 then make object sphere 103,200,50,50:color object 103,rgb(0,255,0):position object 103,0,0,4500:ghost object on 103
comp3x=360*sin(comprotate3#-100)
comp3z=180*cos(comprotate3#-100)
position object 103,comp3x-2300,-1300,comp3z+4500
inc comprotate3#:if compsuper=1 then inc comprotate3#,10
endif
if comppower>3
if object exist(104)=0 then make object sphere 104,200,50,50:color object 104,rgb(0,255,0):position object 104,0,0,4500:ghost object on 104
comp4x=360*sin(comprotate4#-100)
comp4z=180*cos(comprotate4#-100)
position object 104,comp4x-2300,-1200,comp4z+4500
inc comprotate4#:if compsuper=1 then inc comprotate4#,10
endif
if comppower>4
if object exist(105)=0 then make object sphere 105,200,50,50:color object 105,rgb(0,255,0):position object 105,0,0,4500:ghost object on 105
comp5x=180*sin(comprotate5#-100)
comp5z=180*cos(comprotate5#-100)
comp5y=360*sin(comprotate5#-100)
position object 105,comp5x-2300,comp5y-1200,comp5z+4500
inc comprotate5#:if compsuper=1 then inc comprotate5#,10
endif
if comppower>5
if object exist(106)=0 then make object sphere 106,200,50,50:color object 106,rgb(0,255,0):position object 106,0,0,4500:ghost object on 106
comp6x=180*sin(comprotate6#-300)
comp6z=180*cos(comprotate6#-100)
comp6y=360*sin(comprotate6#-100)
position object 106,comp6x-2300,comp6y-1200,comp6z+4500
inc comprotate6#:if compsuper=1 then inc comprotate6#,10
endif
if comppower>6
if object exist(107)=0 then make object sphere 107,200,50,50:color object 107,rgb(255,0,255):position object 107,0,0,4500:ghost object on 107
comp7x=400*sin(comprotate7#-100)
comp7z=100*cos(comprotate7#-100)
position object 107,comp7x-2300,-900,comp7z+4500
inc comprotate7#,4:if compsuper=1 then inc comprotate7#,10
endif
if comppower>7
if object exist(108)=0 then make object sphere 108,200,50,50:color object 108,rgb(255,0,255):position object 108,0,0,4500:ghost object on 108
comp8x=400*sin(comprotate8#-100)
comp8z=100*cos(comprotate8#-100)
position object 108,comp8x-2300,-1500,comp8z+4500
inc comprotate8#,4:if compsuper=1 then inc comprotate8#,10
endif
if comppower>8
if object exist(109)=0 then make object sphere 109,200,50,50:color object 109,rgb(255,0,255):position object 109,0,0,4500:ghost object on 109
comp9y=400*sin(comprotate9#-100)
comp9z=100*cos(comprotate9#-100)
position object 109,-2600,comp9y-1200,comp7z+4500
inc comprotate9#,4:if compsuper=1 then inc comprotate9#,10
endif
if comppower>9
if object exist(110)=0 then make object sphere 110,200,50,50:color object 110,rgb(255,0,255):position object 110,0,0,4500:ghost object on 110
comp10y=400*sin(comprotate10#-100)
comp10z=100*cos(comprotate10#-100)
position object 110,-2000,comp10y-1200,comp10z+4500
inc comprotate10#,4:if compsuper=1 then inc comprotate10#,10
endif
return
 
buttons:
ink 0,0
text 490,535,"Attack"
text 490,577,"Defend"
text 490,620,"Power"
text 478,662,"Inventory"
if over(1,449,520,575,565)
color object 17,rgb(100,155,100)
if mouseclick()=1 and humanturn=1 then clickedatt=1
else
color object 17,rgb(0,155,0)
endif
if over(1,449,565,575,610)
color object 18,rgb(100,155,100)
if mouseclick()=1 and humanturn=1 then clickedshield=1
else
color object 18,rgb(0,155,0)
endif
if over(1,449,608,575,650)
color object 19,rgb(100,155,100)
if mouseclick()=1 then showpower=1:show object 21:show object 22:show object 23:show object 24
if mouseclick()=2 then hide object 21:hide object 22:hide object 23:hide object 24:showpower=0:hide object 25:hide object 26:hide object 27:hide object 28
else
color object 19,rgb(0,155,0)
endif
if over(1,449,651,575,691) then color object 20,rgb(100,155,100) else color object 20,rgb(0,155,0)
if showpower=1
if over(1,603,520,725,565)
color object 21,rgb(100,155,100)
if mouseclick()=1 and humanturn=1 then inc power:humanturn=0:compturn=1
else
color object 21,rgb(0,155,0)
endif
if over(1,603,565,725,610)
color object 22,rgb(100,155,100)
if mouseclick()=1 then showattack=1:show object 25:show object 26:show object 27:show object 28
if mouseclick()=2 then showattack=0:hide object 25:hide object 26:hide object 27:hide object 28
else
color object 22,rgb(0,155,0)
endif
if over(1,603,608,725,650)
color object 23,rgb(100,155,100)
if mouseclick()=1 then showdefense=1
else
color object 23,rgb(0,155,0)
endif
if over(1,603,651,725,691)
color object 24,rgb(100,155,100)
else
color object 24,rgb(0,155,0)
endif
text 635,535,"Power Up"
text 616,577,"Attack Power"
text 613,620,"Defense Power"
text 613,662,"Special Power"
endif
if showattack=1
if over(1,758,520,885,565)
color object 25,rgb(100,155,100)
else
color object 25,rgb(0,155,0)
endif
if over(1,757,565,883,610)
color object 26,rgb(100,155,100)
else
color object 26,rgb(0,155,0)
endif
if over(1,756,608,881,650)
color object 27,rgb(100,155,100)
else
color object 27,rgb(0,155,0)
endif
if over(1,756,651,878,691)
color object 28,rgb(100,155,100)
else
color object 28,rgb(0,155,0)
endif
text 771,535,"Launch Rocket"
text 776,577,"Power Beam"
text 775,620,"Mega Charge"
text 776,662,"'GBE' 1000"
endif
if showdefense=1
endif
return
 
function over(but,x1,y1,x2,y2)
if mousex()>x1 and mousex()<X2
if mousey()>y1 and mousey()<Y2
over_area=1
endif
endif
endfunction over_area