`/////////////////////////////////////////////////////////////////
`/////////////////////Set up the screen ressolution //////////////
`/////////////////////////////////////////////////////////////////
rem check for screen res
if check display mode(640,480,32)=1
set display mode 640,480,32
else
set display mode 640,480,16
endif
sync on
sync rate 60
color backdrop 0
hide mouse
`********************************************************************
`***************************Load in all the graphics*****************
`********************************************************************
load image "gfx\craft\craft4.bmp",1
load image "gfx\alien\alienship.bmp",2
load image "gfx\craft\bomb.bmp",5
load image "gfx\craft\bullet.bmp",4
load image "gfx\exp\exp1.bmp",6
load image "gfx\exp\exp2.bmp",7
load image "gfx\exp\exp3.bmp",8
load image "gfx\exp\exp4.bmp",9
load image "gfx\exp\exp5.bmp",10
load image "gfx\exp\exp6.bmp",11
`**********images for level one floor**
load image "gfx\level1\f1.bmp",13
load image "gfx\level1\f2.bmp",14
load image "gfx\level1\f3.bmp",15
load image "gfx\level1\f4.bmp",17
load image "gfx\level1\f5.bmp",18
load image "gfx\level1\f6.bmp",19
load image "gfx\level1\f7.bmp",20
load image "gfx\level1\f8.bmp",21
load image "gfx\level1\f9.bmp",22
load image "gfx\level1\f10.bmp",23
load image "gfx\level1\f11.bmp",24
load image "gfx\level1\f12.bmp",25
load image "gfx\level1\f13.bmp",26
load image "gfx\level1\f14.bmp",27
load image "gfx\level1\f15.bmp",28
load image "gfx\level1\f16.bmp",29
load image "gfx\level1\f17.bmp",30
load image "gfx\level1\f18.bmp",31
load image "gfx\level1\f19.bmp",32
load image "gfx\level1\f20.bmp",33
load image "gfx\level1\f21.bmp",34
load image "gfx\level1\f22.bmp",35
load image "gfx\level1\f23.bmp",36
`**********images for level two floor***
load image "gfx\level2\f24.bmp",37
load image "gfx\level2\f25.bmp",38
load image "gfx\level2\f26.bmp",39
load image "gfx\level2\f27.bmp",40
load image "gfx\level2\f28.bmp",41
load image "gfx\level2\f29.bmp",42
load image "gfx\level2\f30.bmp",43
load image "gfx\level2\f31.bmp",44
load image "gfx\level2\f32.bmp",45
load image "gfx\level2\f33.bmp",46
load image "gfx\level2\f34.bmp",47
load image "gfx\level2\f35.bmp",48
load image "gfx\level2\f36.bmp",49
load image "gfx\level2\f37.bmp",50
load image "gfx\level2\f38.bmp",51
load image "gfx\level2\f39.bmp",52
load image "gfx\level2\f40.bmp",53
load image "gfx\level2\f41.bmp",54
load image "gfx\level2\f42.bmp",55
load image "gfx\level2\f43.bmp",56
load image "gfx\level2\f44.bmp",57
load image "gfx\level2\f45.bmp",58
load image "gfx\level2\f46.bmp",59
load image "gfx\level2\f47.bmp",60
load image "gfx\level2\f48.bmp",61
load image "gfx\level2\f49.bmp",62
load image "gfx\level2\f50.bmp",63
load image "gfx\level2\f51.bmp",64
load image "gfx\level2\f52.bmp",65
load image "gfx\level2\f53.bmp",66
`**********images for level three floor**
load image "gfx\level3\f61.bmp",67
load image "gfx\level3\f62.bmp",68
load image "gfx\level3\f63.bmp",69
load image "gfx\level3\f64.bmp",70
load image "gfx\level3\f65.bmp",71
load image "gfx\level3\f66.bmp",72
`load image "gfx\level3\f67.bmp",73
`**********images for level two roof***
load image "gfx\level2\f54.bmp",74
load image "gfx\level2\f55.bmp",75
load image "gfx\level2\f56.bmp",76
load image "gfx\level2\f57.bmp",77
load image "gfx\level2\f58.bmp",78
load image "gfx\level2\f59.bmp",79
load image "gfx\level2\f60.bmp",80
`**********images for the screen**
load image "gfx\craft\score.bmp",198
load image "gfx\craft\life1.bmp",199
load image "gfx\screen\stars.bmp",200
load image "gfx\screen\title.bmp",201
load image "gfx\screen\Level_1_Mark.bmp",202
load image "gfx\screen\Level_2_Mark.bmp",203
load image "gfx\screen\Level_3_Mark.bmp",204
load image "gfx\screen\Level_Change.bmp",205
load image "gfx\screen\ready.bmp",206
load image "gfx\screen\Level_boss_Mark.bmp",207
`********************************************************************
`***************************Load in all the Sounds*******************
`********************************************************************
LOAD SOUND "sounds\phaser03.wav",1
LOAD SOUND "sounds\boom2.wav",2
`********************************************************************
`***************************Setup a 3D plain for stars***************
`********************************************************************
MAKE OBJECT PLAIN 4,600,56
ghost object on 4
POSITION OBJECT 4,0,-4,80
TEXTURE OBJECT 4,200
LOCK OBJECT ON 4
color backdrop rgb(0,0,0)
`********************************************************************
`***************************Variable List****************************
`********************************************************************
` Set the weapon fired
pf=0
` Score
score=0
` Lives
lives=3
` Spacseship co-ordinates
craftx=50
crafty=200
` Set Collision Detection
sbu=0
` Number of Explosions
noe=6:gs=0
` Bomb Attributes
dim grav#(1) : grav#(1)=10
dim hu(1) : hu(1)=10
dim vu(1) : vu(1)=0
dim height(1) : height(1)=100
dim time(1) :time(1)=10
`********************************************************************
`***************************Setup the Walls**************************
`********************************************************************
`Here a Loop sets up the wall tiles so that they do not over lap when
`they are placed on screen.
`*************Setup the floor tiles
bs=10
`set the start off tile onscreen
x=-200
y=320
`loop for tile 1 to 77
for t=1 to 78
read im
`*************First level floor
if im<=74 then x=x+112
if im=13 or im=14 or im=15 or im=16 or im=17 or im=18 or im=19 or im=20 then x=x:y=y-79
if im=21 or im=22 or im=23 or im=24 or im=25 or im=26 or im=27 or im=28 then x=x:y=y-79
if im=29 or im=30 or im=31 or im=32 or im=33 or im=34 or im=35 or im=36 then x=x:y=y-79
`**************Second level floor
if im=37 or im=38 or im=39 or im=40 or im=41 or im=42 or im=43 or im=44 then y=y-137
if im=45 or im=46 or im=47 or im=48 or im=49 or im=50 or im=51 or im=52 then y=y-137
if im=53 or im=54 or im=55 or im=56 or im=57 or im=58 or im=59 or im=60 then y=y-137
if im=61 or im=62 or im=63 or im=64 or im=65 or im=66 then y=y-137
`**************Third level floor
if im=67 or im=68 or im=69 or im=70 or im=71 or im=72 then y=y-137
sprite bs,x,y,im
bs=bs+1:y=320
next t
`*************Setup the roof tiles
x=3110
y=92
`loop for tile 0 to 200
for t=79 to 200
read im
`*************Level two roof
if im<82 then x=x+112
sprite bs,x,y,im
bs=bs+1:y=92
next t
`****************************************
`*************Setup ship and player ready
`****************************************
x=-500
for t=67 to 74
`sprite 111,x,200,206
x=x+10
gosub movestars
sync
next t
x=-50:y=200
for t=1 to 100
sprite 1,x,y,1
x=x+1
gosub movestars
sync
next t
`delete sprite 111
`************************************************************
`***** Place the 3 Invisiable level flags *******************
`************************************************************
`**level 1 to 2
sprite 111,3080,60,205
`**level 2 to 3
sprite 112,6400,60,205
`**level 3 to boss
sprite 113,8000,60,205
`***** Place the Guns and Tanks on screen *******************
`sprite 114,2550,305,16
`sprite 115,4300,305,16
`////////////////////////////////////////////////////////////
`//////////////// Start of Main Loop ////////////////////////
`////////////////////////////////////////////////////////////
do
`Load The Level Marker
sprite 202,210,70,202
`Load Title to the screen
sprite 201,210,10,201
`Load score
sprite 198,480,420,198
` Prints out score etc....
set cursor 490,440: Print "SCORE:";score
`Load the lives on the Screen
sprite 116,50,440,199
sprite 117,70,440,199
sprite 118,90,440,199
`**************************************************************
`************** KEY DIRECTION AND FIRE FUNCTIONS **************
`**************************************************************
REM Upkey to move space ship Up
if UPKEY()=1 and crafty>100
dec crafty,10
endif
REM Downkey to move space ship Down
if DOWNKEY()=1 and crafty<400
inc crafty,10
endif
REM Leftkey to move space ship Up
if LEFTKEY()=1 and craftx>10
dec craftx,10
endif
REM Rightkey to move space ship Down
if RIGHTKEY()=1 and craftx<400
inc craftx,10
endif
REM X key to fire Bullet
if inkey$()="x" and pf=0 then gosub shoot:pf=1
REM Z key to fire Bullet
if inkey$()="z" then gosub bomb
`*****************************************************************
`******************* COLLISION DETECTION *************************
`*****************************************************************
`****************** Collision between lazer and other objects
if SPRITE EXIST(2)=1
if SPRITE HIT(2,0)>1 then PLAY SOUND 2:sbu=1
endif
`If the lazer hits an object blow it up
if sbu=1 then gosub blowitup
`******************* Collision between craft and invisible marker
if SPRITE EXIST(1)
if SPRITE COLLISION(1,111)=1 then gosub change_level1
endif
if SPRITE EXIST(1)
if SPRITE COLLISION(1,112)=1 then gosub change_level2
endif
if SPRITE EXIST(1)
if SPRITE COLLISION(1,113)=1 then gosub change_boss
endif
`*****************************************************************
`******************** UPDATE OBJECTS *****************************
`*****************************************************************
`Just update your players sprite, stars and your lazer
`IF you fired it of cause.
sprite 1,craftx,crafty,1
if sbu=0 then gosub moveall
gosub movestars
`********************************************
`Move all boundry sprites (For-Next loop)
`Deletes objects when they leave screen
`********************************************
for t=10 to 115
bsx=SPRITE X(t):bsy=SPRITE Y(t):bsi=SPRITE IMAGE(t)
bsx=bsx-4
sprite t,bsx,bsy,bsi
if bsx<-113 then delete sprite t
next t
sync
loop
`////////////////////////////////////////////////////////////
`//////////////// End of Main Loop //////////////////////////
`////////////////////////////////////////////////////////////
`////////////////////////////////////////////////////////////
`//////////////// Start of GoSub Functions //////////////////
`////////////////////////////////////////////////////////////
`***************Scroll Stars
movestars:
SCROLL OBJECT TEXTURE 4,0.01,0.0
return
`***************Fire Lazer
shoot:
sprite 2,lx,ly,4
PLAY SOUND 1
return
`***************Fire Bomb
bomb:
`sync on
`sync rate 60
for time = 0 to time(1)
sh=(hu(1)*time)+50
sv=(0.5*grav#(1))*(time*time)
`cls
sprite 5,sh,sv,5
`sync
wait 0
next time
`cls
`sync
return
`***************Change Level 1 Display
change_level1:
DELETE SPRITE 202
sprite 203,210,70,203
return
`***************Change Level 2 Display
change_level2:
DELETE SPRITE 202
sprite 204,210,70,204
return
`***************Change Level boss Display
change_boss:
DELETE SPRITE 202
sprite 207,210,70,207
return
`***************Move your lazer if its on screen
moveall:
if SPRITE EXIST(2)=1
If sprite X(2)<640
lx=lx+45
sprite 2,lx,ly,4
endif
endif
if SPRITE EXIST(2)=1
If sprite X(2)>=640
pf=0
lx=SPRITE X(1)-20
ly=SPRITE Y(1)+5
endif
endif
return
`**************Cycle for the Explosions, check last exp 11 to loop.
blowitup:
sprite 2,lx,ly,noe
if noe<11
inc noe
return
endif
if noe>=11
noe=6
lx=SPRITE X(1)+20
ly=SPRITE Y(1)+10
sprite 2,640,ly,4
pf=0:sbu=0
return
endif
`////////////////////////////////////////////////////////////
`////////////////// End of GoSub Functions //////////////////
`////////////////////////////////////////////////////////////
`////////////////////////////////////////////////////////////
`////////////////// Data Blocks to build layout//////////////
`////////////////////////////////////////////////////////////
`**************level 1 floor
data 13,13,13,13,13,14,15,15,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36
`**************level 2 floor
data 37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66
data 67,68,69,70,71,69,70,70,70,70,70,70,70,70,70,72,72,72,72,72
`**************level 2 roof
data 74,75,76,77,78,79,78,79,78,79,78,79,78,79,78,79,78,79,78,79,78,79,80