Laser Assault 3
remstart
-------------------------------------------------------------------
Program name: Laser Assault 3
-------------------------------------------------------------------
Written by: UFO
Date: 2/1/06
-------------------------------------------------------------------
Arrays: PlayerBullet#(50,4) 1-exists 2-x 3-y 4-z angle
Wave(amtlevels,20,4) 1-type 2-amount 3-timer 4-randomizATION
Alien#(40,7) 1-exists 2-x 3-y 4-angle 5-type 6-speed 7-shoot timer 8-health 9-1 10-2 11-3 12-4
Explosion#(20,4) 1-exists 2-x 3-y 4-frame
AlienBullet#(50,4) 1-exists 2-x 3-y 4-z angle
AlienMissle#(25,4) 1-exists 2-x 3-y 4-z angle
Coin#(50,4) 1-exists 2-x 3-y 4-zang 5-mode
Images: 1-Player 1000-Background 1001-PlayerBullet# 500-520-Aliens
100-115-explosion 1002-alien laser 1003-Alien missle 1004-pod 200-powerups
1005-coin 1006-Fireball
Plains: 1-Player 500-549-PlayerBullets 1000-Background 10-49-ALiens
100-119-Explosions 600-649-Alien Bullets 700-724-Alien Missles
725-750-alien missles 200-203-pods 210-212 powerups 800-849-Alien Flame
900-950-coins 300-374-fireballs
-------------------------------------------------------------------
remend
`GAME SETUP
set display mode 640,480,16
Sync on
hide mouse
autocam off
sync rate 70
`Set camera view 0,90,640,390
color backdrop 0
begingame:
Menu
`WHOLE GAME VARIABLES
`(Variables used the whole game and does not change)
Dim AmountLevels(0)
AmountLevels(0) = 4
Amtlevels = 4
Dim Amountofwaves(Amtlevels)
Dim Wave(Amtlevels,20,4)
Dim AlienNum(amtlevels,20)
Dim Wavenum(amtlevels)
Dim Level(0)
Level(0) = 1
Dim MPB(0)
MPB(0) = 49
Dim Shoot_Status(0)
Shoot_Status(0) = 1
Dim Keypress(0)
Dim Health(0)
Health(0) = 10
Dim Score(0)
Score(0) = 0
Dim Pods(0)
Pods(0) = 0
Position camera 0,0,-38
Point camera 0,0,0
randomize timer()
Load_Levels
Load_Player
Load_Player_Bullets
Load_Aliens
Load_Explosion
Load_Sounds
Load_Music
Load_Coins
Load_Enemy_Bullets
Load_Enemy_Missles
Load_Enemy_flames
Load_Powerups
Load_Pods
Load_Fireballs
Levelstart:
`LEVEL VARIABLES
`(Variables that will change, and is only used for the level,
`and will need to be reset at the begining of each level)
Dim Alien#(40,12)
Dim ALientimer(0)
Dim PlayerBullet#(49,4)
Dim Explosion#(20,4)
Dim AlienNumber(0)
Dim AlienBullet#(50,4)
Dim AlienMissle#(25,4)
Dim AlienFlame#(50,5)
Dim Drain(3)
Dim Add#(3)
Dim Sheild(0)
Sheild(0) = 10
Dim Energy(0)
Energy(0) = 100
Dim Powerup#(3,4)
Dim Star(0)
Dim NoNew(0)
NoNew(0) = 0
Dim Timerthing(0)
Timerthing(0) = 0
Dim Important(0)
Important(0) = 0
Dim Coin#(50,5)
Dim Camerashake#(2)
Dim Fireball#(75,5)
`LEVEL SETUP
Load_Background(level(0))
If image exist(5) = 1 then delete image 5
Load image "media/hud.png",5
Player_Intro
Alientimer(0) = timer()
color backdrop 0
Loopnum = 1
Do
control_player
Player_Shoot
Move_Player_Bullets
Move_Enemy_Bullets
Move_Enemy_Missles
Move_Enemy_Flames
Move_Powerups
Move_Coins
Move_Fireballs
Update_Shake
Move_Aliens
Alien_Shoot
Bullet_Collision_ALiens
Player_Alien_Collision
Powerup_Collision
Coin_Collision
Alien_Bullet_Collision_Player
Missle_Collision_Player
Alien_Flame_Collision_Player
Draw_Explosion
Position_pods
Move_Powerups
Texture object 1,1
If star(0) > 0
star(0) = star(0) - 10
energy(0) = 100
sheild(0) = 10
drain(1) = 0
drain(2) = 0
drain(3) = 0
add#(1) = 0
add#(2) = 0
add#(3) = 0
endif
If star(0) = 10 then play sound 11
Setup_Hud
scroll object texture 1000,0.001,0.0
scroll object texture 1001,0.0005,0.0
IF ALienNum(level(0),wavenum(level(0))) = Wave(Level(0),Wavenum(Level(0)),2) and NoNew(0) = 0 then New_Wave
If wavenum(Level(0)) - 1 = amountofwaves(Level(0)) or inkey$() = "d"
NoNew(0) = 1
For x = 1 to 40
IF ALien#(x,1) = 1 and inkey$() <> "d" then goto Thiswontwork
NExt x
IF timerthing(0) = 120
level(0) = Level(0) + 1
For I = 500 to 549
IF object exist(I) = 1 then Position object I,0,0,1
next I
For I = 10 to 49
IF object exist(I) = 1 then Position object I,0,0,1
next I
For I = 100 to 119
IF object exist(I) = 1 then Position object I,0,0,1
next I
For I = 600 to 649
IF object exist(I) = 1 then Position object I,0,0,1
next I
For I = 700 to 750
IF object exist(I) = 1 then Position object I,0,0,1
next I
For I = 800 to 849
IF object exist(I) = 1 then Position object I,0,0,1
next I
For I = 210 to 212
IF object exist(I) = 1 then Position object I,0,0,1
next I
For I = 900 to 950
IF object exist(I) = 1 then Position object I,0,0,1
next I
Player_LEave
goto levelstart
endif
timerthing(0) = timerthing(0) + 1
Thiswontwork:
endif
If Wave(Level(0),wavenum(Level(0)),3) < timer() - alientimer(0) and NoNew(0) = 0 then Create_Aliens
If inkey$() = "a"
shoot_status(0) = shoot_status(0) + 1
repeat
sync
until inkey$() = ""
endif
If inkey$() = "s"
pods(0) = pods(0) + 1
repeat
sync
until inkey$() = ""
endif
Ink rgb(255,0,0),0
Set Text Font "Bank Gothic Medium BT"
Set text size 20
Text 2,75,"FPS: "+str$(screen fps())
Text 320,450,"Level 1: Returning To Earth"
Loopnum = Loopnum + 1
If loopnum = 2
If drain(1) > 0 then Drain(1) = Drain(1) - 1
If drain(2) > 0 then Drain(2) = Drain(2) - 1
If drain(3) > 0 then Drain(3) = Drain(3) - 1
If sheild(0) < 10 then Add#(2) = Add#(2) + 0.05
If energy(0) < 100 then add#(3) = Add#(3) + 0.7
If Add#(2) > 7
Add#(2) = Add#(2) - 7
Sheild(0) = Sheild(0) + 1
endif
If Add#(3) > 1
Add#(3) = Add#(3) - 1
energy(0) = energy(0) + 1
endif
loopnum = 1
endif
If sheild(0) < 0 then sheild(0) = 0
If energy(0) < 0 then energy(0) = 0
IF health(0) = 0
hide object 1
position object 1,-100,0,-1
cAmera_Shake(1.0,60.0)
repeat
Move_Player_Bullets
Move_Enemy_Bullets
Move_Enemy_Missles
Move_Enemy_Flames
Move_Powerups
Move_Coins
Move_Fireballs
Update_Shake
Move_Aliens
Alien_Shoot
Bullet_Collision_ALiens
Draw_Explosion
Position_pods
Move_Powerups
Ink rgb(255,0,0),0
Set Text Font "Bank Gothic Medium BT"
Set text size 50
Center text 320,220,"You Lose"
sync
until returnkey() = 1
For I = 1 to 1005
IF object exist(I) = 1 then Delete object I
next I
goto begingame
endif
sync
Loop
Function Load_Background(level)
Load image "media/backgrounds/1.png",1000
If object exist(1000) = 1 then delete object 1000
Make object plain 1000,153,30
Texture object 1000,1000
Load image "media/backgrounds/"+str$(level+1)+".bmp",1001
IF object exist(1001) = 1 then delete object 1001
make object plain 1001,75,30
Texture object 1001,1001
Ghost object on 1001
endfunction
Function Load_Player()
Load image "media/Player.png",1
Make object plain 1,5,3
Texture object 1,1
Set object 1,1,0,1
Ghost object on 1
endfunction
Function Player_Intro()
Position object 1,-60,0,-1
If pods(0) > 0
Position object 200,object position x(1),object position y(1)-2,-1
If pods(0) > 1
Position object 201,object position x(1),object position y(1)+2,-1
If pods(0) > 2
Position object 202,object position x(1)-2,object position y(1)-4,-1
If pods(0) > 3
Position object 203,object position x(1)-2,object position y(1)+4,-1
endif
endif
endif
endif
For x = -60 to -20
Position object 1,x,object position y(1),object position z(1)
Position_pods
Setup_HUD
sync
Next x
endfunction
Function Player_LEave()
playerx = int(object position x(1))
For x = playerx to 35
Position object 1,x,object position y(1),object position z(1)
Position_pods
Setup_HUD
sync
Next x
endfunction
Function Control_Player()
If upkey() = 1 and object position y(1) < 13 then position object 1,object position x(1),object position y(1)+0.5,object position z(1)
If downkey() = 1 and object position y(1) > -13 then position object 1,object position x(1),object position y(1)-0.5,object position z(1)
If leftkey() = 1 and object position x(1) > -27 then position object 1,object position x(1)-0.5,object position y(1),object position z(1)
If rightkey() = 1 and object position x(1) < 27 then position object 1,object position x(1)+0.5,object position y(1),object position z(1)
endfunction
Function Player_Shoot()
If controlkey() = 1 and keypress(0) = 0 and energy(0) > 50
Play sound 5
IF shoot_status(0) < 5 then energy(0) = energy(0) - shoot_status(0)*2
If shoot_status(0) > 4 then energy(0) = energy(0) - (shoot_status(0)-4)
If pods(0) > 0
For I = 1 to mpb(0)
If playerbullet#(I,1) = 0
Pshoot(I,object position x(200),object position y(200),0)
goto leavethispodshoot1
endif
Next I
leavethispodshoot1:
If pods(0) > 1
For I = 1 to mpb(0)
If playerbullet#(I,1) = 0
Pshoot(I,object position x(201),object position y(201),0)
goto leavethispodshoot2
endif
Next I
leavethispodshoot2:
If pods(0) > 2
For I = 1 to mpb(0)
If playerbullet#(I,1) = 0
Pshoot(I,object position x(202),object position y(202),0)
goto leavethispodshoot3
endif
Next I
leavethispodshoot3:
If pods(0) > 3
For I = 1 to mpb(0)
If playerbullet#(I,1) = 0
Pshoot(I,object position x(203),object position y(203),0)
goto leavethispodshoot4
endif
Next I
leavethispodshoot4:
endif
endif
endif
endif
If shoot_status(0) = 1 or shoot_status(0) = 5 : `111111111111111111111111111
For I = 1 to MPB(0)
If PlayerBullet#(I,1) = 0
PShoot(I,Object position x(1)-2,object position y(1),int(wrapvalue(-5+rnd(10))))
goto exitthisfornextloop1
endif
Next I
exitthisfornextloop1:
endif
If shoot_status(0) = 2 or shoot_status(0) = 6 : `222222222222222222222222222
For I = 1 to MPB(0)
If PlayerBullet#(I,1) = 0
PShoot(I,Object position x(1)-2,object position y(1)-1,0)
goto exitthisfornextloop2
endif
Next I
exitthisfornextloop2:
For I = 1 to MPB(0)
If PlayerBullet#(I,1) = 0
PShoot(I,Object position x(1)-2,object position y(1)+1,0)
goto exitthisfornextloop3
endif
Next I
exitthisfornextloop3:
endif
If shoot_status(0) = 3: `333333333333333333333333333333
For I = 1 to MPB(0)
If PlayerBullet#(I,1) = 0
PShoot(I,Object position x(1)-2,object position y(1),350)
goto exitthisfornextloop4
endif
Next I
exitthisfornextloop4:
For I = 1 to MPB(0)
If PlayerBullet#(I,1) = 0
PShoot(I,Object position x(1)-2,object position y(1),0)
goto exitthisfornextloop5
endif
Next I
exitthisfornextloop5:
For I = 1 to MPB(0)
If PlayerBullet#(I,1) = 0
PShoot(I,Object position x(1)-2,object position y(1),10)
goto exitthisfornextloop6
endif
Next I
exitthisfornextloop6:
endif
If shoot_status(0) = 4: `4444444444444444444444444444444444
For I = 1 to MPB(0)
If PlayerBullet#(I,1) = 0
PShoot(I,Object position x(1)-2,object position y(1)+1,0)
goto exitthisfornextloop7
endif
Next I
exitthisfornextloop7:
For I = 1 to MPB(0)
If PlayerBullet#(I,1) = 0
PShoot(I,Object position x(1)-2,object position y(1)-1,0)
goto exitthisfornextloop8
endif
Next I
exitthisfornextloop8:
For I = 1 to MPB(0)
If PlayerBullet#(I,1) = 0
PShoot(I,Object position x(1)-2,object position y(1)+1,355)
goto exitthisfornextloop9
endif
Next I
exitthisfornextloop9:
For I = 1 to MPB(0)
If PlayerBullet#(I,1) = 0
PShoot(I,Object position x(1)-2,object position y(1)-1,5)
goto exitthisfornextloop10
endif
Next I
exitthisfornextloop10:
endif
keypress(0) = 9
IF shoot_status(0) > 4 then keypress(0) = 5
endif
IF controlkey() = 0 then keypress(0) = 0
IF keypress(0) > 0 then keypress(0) = keypress(0) - 1
Endfunction
Function PShoot(Num,Bulletx#,Bullety#,angle)
PlayerBullet#(Num,1) = 1
PlayerBullet#(Num,2) = Bulletx#
PlayerBullet#(Num,3) = Bullety#
PlayerBullet#(Num,4) = angle
Position object 499+Num,PlayerBullet#(Num,2),PlayerBullet#(Num,3),-1
Endfunction
Function Load_Player_Bullets
Load image "media/Bullet.bmp",1001
For I = 500 to 500+MPB(0)
Make object plain I,1,0.5
Texture object I,1001
Set object I,1,0,1
Ghost object on I
position object I,0,0,1
next I
Endfunction
Function Move_Player_Bullets()
For I = 1 to MPB(0)
If PlayerBullet#(I,1) = 1
If object position x(499+I) > 30 then PlayerBullet#(I,1) = 0
If object position x(499+I) < -30 then playerbullet#(I,1) = 0
If object position y(499+I) > 16 then PlayerBullet#(I,1) = 0
If object position y(499+I) < -16 then playerbullet#(I,1) = 0
zrotate object 499+I,PlayerBullet#(I,4)
yrotate object 499+I,90
move object I+499,1
yrotate object 499+I,0
PlayerBullet#(I,2) = object position x(499+I)
PlayerBullet#(I,3) = Object position y(499+I)
endif
next I
Endfunction
Function Load_Levels
For I = 1 to amountLevels(0)
Open to read 1,"media/level data/level"+str$(I)+".txt"
Read string 1,numofwaves$
Amountofwaves(I) = val(numofwaves$)
For X = 1 to Amountofwaves(I)
Read string 1,junk$
Read string 1,alientype$
Read string 1,amountofaliens$
Read string 1,timer$
Read string 1,randomization$
Wave(I,X,1) = val(alientype$)
Wave(I,X,2) = val(amountofaliens$)
Wave(I,X,3) = val(timer$)
Wave(I,X,4) = val(randomization$)
Wavenum(I) = 0
Next X
close file 1
next I
Endfunction
Function Load_Aliens
For I = 1 to 8
Load image "media/aliens/"+str$(I)+".png",499+I
Next I
Load image "Media/aliens/3-2.png",510
Endfunction
Function New_Wave
wavenum(Level(0)) = Wavenum(Level(0)) + 1
AlienNum(Level(0),wavenum(level(0))) = 1
Endfunction
Function Create_Aliens
` If wave(Level(0),wavenum(Level(0)),1) = 1
For I = 1 to 40
If Alien#(I,1) = 0
IF object exist(I+9) = 1 then delete object I+9
If Wave(Level(0),wavenum(Level(0)),1) = 1 then Make object plain I+9,5,2
If Wave(Level(0),wavenum(Level(0)),1) = 2 then Make object plain I+9,5,3
If wave(level(0),wavenum(Level(0)),1) = 3 then Make object plain I+9,4,4
If wave(level(0),wavenum(Level(0)),1) = 4 then Make object plain I+9,6.5,3
If wave(level(0),wavenum(Level(0)),1) = 5 then Make object plain I+9,5,4
If wave(level(0),wavenum(Level(0)),1) = 6 then Make object plain I+9,6,4
If wave(level(0),wavenum(Level(0)),1) = 7 then Make object plain I+9,14,17
If wave(level(0),wavenum(Level(0)),1) = 8 then Make object plain I+9,4,4
Texture object I+9,wave(level(0),wavenum(Level(0)),1)+499
Set object I+9,1,0,1
Ghost object on I+9
`position object 9+I,0,0,1
Alien#(I,1) = 1
Alien#(I,2) = 33
IF ALien#(I,5) = 7 then ALien#(I,2) = 39
If Wave(Level(0),wavenum(Level(0)),1) = 1 then Alien#(I,3) = rnd(26)-13
If Wave(Level(0),wavenum(Level(0)),1) = 2 then Alien#(I,3) = rnd(20)-10
If Wave(Level(0),wavenum(Level(0)),1) = 3 then Alien#(I,3) = rnd(26)-13
If Wave(Level(0),wavenum(Level(0)),1) = 4 then Alien#(I,3) = rnd(26)-13
If Wave(Level(0),wavenum(Level(0)),1) = 5 then Alien#(I,3) = rnd(26)-13
If Wave(Level(0),wavenum(Level(0)),1) = 6 then Alien#(I,3) = rnd(20)-10
If Wave(Level(0),wavenum(Level(0)),1) = 7 then Alien#(I,3) = 0
If Wave(Level(0),wavenum(Level(0)),1) = 8 then Alien#(I,3) = 0
If Wave(Level(0),wavenum(Level(0)),1) = 1 then Alien#(I,4) = 0
If Wave(Level(0),wavenum(Level(0)),1) = 2 then Alien#(I,4) = wrapvalue(340+rnd(40))
If Wave(Level(0),wavenum(Level(0)),1) = 3 then Alien#(I,4) = wrapvalue(rnd(360))
If Wave(Level(0),wavenum(Level(0)),1) = 4 then Alien#(I,4) = 0
If Wave(Level(0),wavenum(Level(0)),1) = 5 then Alien#(I,4) = 0
If Wave(Level(0),wavenum(Level(0)),1) = 6 then Alien#(I,4) = 0
If Wave(Level(0),wavenum(Level(0)),1) = 7 then Alien#(I,4) = 0
If Wave(Level(0),wavenum(Level(0)),1) = 8 then Alien#(I,4) = 0
Alien#(I,5) = Wave(Level(0),wavenum(Level(0)),1)
If Wave(Level(0),wavenum(Level(0)),1) = 1 then Alien#(I,6) = 0.25
If Wave(Level(0),wavenum(Level(0)),1) = 2 then Alien#(I,6) = 0.5
If Wave(Level(0),wavenum(Level(0)),1) = 3 then Alien#(I,6) = 0.5
If Wave(Level(0),wavenum(Level(0)),1) = 4 then Alien#(I,6) = 0.1
If Wave(Level(0),wavenum(Level(0)),1) = 5 then Alien#(I,6) = 0.7
If Wave(Level(0),wavenum(Level(0)),1) = 6 then Alien#(I,6) = 0.2
If Wave(Level(0),wavenum(Level(0)),1) = 7 then Alien#(I,6) = 1
If Wave(Level(0),wavenum(Level(0)),1) = 8 then Alien#(I,6) = 1
If Wave(Level(0),wavenum(Level(0)),1) = 1 then Alien#(I,7) = 500+(rnd(250)-120)
If Wave(Level(0),wavenum(Level(0)),1) = 2 then Alien#(I,7) = 250+(rnd(120)-60)
If Wave(Level(0),wavenum(Level(0)),1) = 3 then Alien#(I,7) = 240+(rnd(60)-30)
If Wave(Level(0),wavenum(Level(0)),1) = 4 then Alien#(I,7) = 100+(rnd(50)-25)
If Wave(Level(0),wavenum(Level(0)),1) = 5 then Alien#(I,7) = 240+(rnd(200)-100)
If Wave(Level(0),wavenum(Level(0)),1) = 6 then Alien#(I,7) = 75
If Wave(Level(0),wavenum(Level(0)),1) = 7 then Alien#(I,7) = 150
If Wave(Level(0),wavenum(Level(0)),1) = 8 then Alien#(I,7) = 0
If Wave(Level(0),wavenum(Level(0)),1) = 1 then Alien#(I,8) = 0
If Wave(Level(0),wavenum(Level(0)),1) = 2 then Alien#(I,8) = 0
If Wave(Level(0),wavenum(Level(0)),1) = 3 then Alien#(I,8) = 1
If Wave(Level(0),wavenum(Level(0)),1) = 4 then Alien#(I,8) = 5
If Wave(Level(0),wavenum(Level(0)),1) = 5 then Alien#(I,8) = 7
If Wave(Level(0),wavenum(Level(0)),1) = 6 then Alien#(I,8) = 7
If Wave(Level(0),wavenum(Level(0)),1) = 7 then Alien#(I,8) = 1000
If Wave(Level(0),wavenum(Level(0)),1) = 8 then Alien#(I,8) = 10
If Wave(Level(0),wavenum(Level(0)),1) = 5 then Alien#(I,9) = ALien#(I,2)
If Wave(Level(0),wavenum(Level(0)),1) = 6 then Alien#(I,9) = 70
If Wave(Level(0),wavenum(Level(0)),1) = 7 then Alien#(I,9) = 0
If Wave(Level(0),wavenum(Level(0)),1) = 5 then Alien#(I,10) = Alien#(I,3)
If Wave(Level(0),wavenum(Level(0)),1) = 6 then Alien#(I,10) = 5
If Wave(Level(0),wavenum(Level(0)),1) = 7 then Alien#(I,10) = 60
If Wave(Level(0),wavenum(Level(0)),1) = 7 then Alien#(I,12) = 0
Alientimer(0) = timer() + (rnd(Wave(Level(0),wavenum(Level(0)),4))-Wave(Level(0),wavenum(Level(0)),4)/2)
Position object I+9,Alien#(I,2),Alien#(I,3),-1
AlienNum(Level(0),wavenum(Level(0))) = AlienNum(Level(0),wavenum(Level(0))) + 1
Aliennumber(0) = Aliennumber(0) + 1
goto goodbyefornextloop
endif
Next I
Goodbyefornextloop:
` endif
Endfunction
Function Move_Aliens
For I = 1 to 40
IF Alien#(I,1) = 1
IF Alien#(I,5) = 1
zrotate object 9+I,Alien#(I,4)
yrotate object 9+I,90
move object I+9,Alien#(I,6)*-1
yrotate object 9+I,0
Alien#(I,2) = object position x(I+9)
Alien#(I,3) = object position y(I+9)
alien#(I,4) = object angle z(I+9)
If Alien#(I,2) < -30
Alien#(I,1) = 0
Delete object I+9
endif
endif
IF Alien#(I,5) = 2
zrotate object 9+I,Alien#(I,4)
If object position y(1) > ALien#(I,3) then zrotate object 9+I,wrapvalue(object angle z(9+I)-1)
If object position y(1) < ALien#(I,3) then zrotate object 9+I,wrapvalue(object angle z(9+I)+1)
yrotate object 9+I,90
move object I+9,Alien#(I,6)*-1
yrotate object 9+I,0
Alien#(I,2) = object position x(I+9)
Alien#(I,3) = object position y(I+9)
alien#(I,4) = object angle z(I+9)
If Alien#(I,2) < -30
Alien#(I,1) = 0
Delete object I+9
endif
endif
IF Alien#(I,5) = 3
If object position x(1) > ALien#(I,2) - 35 and object position x(1) < Alien#(I,2) and object position y(1) > Alien#(I,3) - 5 and object position y(1) < Alien#(I,3) + 5
ALien#(I,6) = 1
Texture object 9+I,510
endif
ALien#(I,4) = wrapvalue(ALien#(I,4)-10)
zrotate object 9+I,Alien#(I,4)
yrotate object 9+I,90
Position object 9+I,Alien#(I,2)-ALien#(I,6),Alien#(I,3),-1
yrotate object 9+I,0
Alien#(I,2) = object position x(I+9)
Alien#(I,3) = object position y(I+9)
alien#(I,4) = object angle z(I+9)
If Alien#(I,2) < -30
Alien#(I,1) = 0
Delete object I+9
endif
endif
IF Alien#(I,5) = 4
zrotate object 9+I,Alien#(I,4)
yrotate object 9+I,90
move object I+9,Alien#(I,6)*-1
yrotate object 9+I,0
Alien#(I,2) = object position x(I+9)
Alien#(I,3) = object position y(I+9)
alien#(I,4) = object angle z(I+9)
If Alien#(I,2) < -30
Alien#(I,1) = 0
Delete object I+9
endif
endif
IF Alien#(I,5) = 5
Position object 9+I,curvevalue(Alien#(I,9),Alien#(I,2),70),curvevalue(Alien#(I,10),Alien#(I,3),70),-1
If ALien#(I,9) < Alien#(I,2)+2 and ALien#(I,9) > Alien#(I,2)-2 and Alien#(I,10) < Alien#(I,3)+2 and Alien#(I,10) > Alien#(I,3)-2
Alien#(I,9) = rnd(50)-25
Alien#(I,10) = rnd(20)-10
endif
Point object 9+I,object position x(1),object position y(1),-1
zrotate object 9+I,object angle x(I+9)
xrotate object 9+I,0
yrotate object 9+I,0
Alien#(I,2) = object position x(I+9)
Alien#(I,3) = object position y(I+9)
alien#(I,4) = wrapvalue(object angle z(I+9)+180)
If Alien#(I,2) < -30
Alien#(I,1) = 0
Delete object I+9
endif
endif
IF Alien#(I,5) = 6
IF rnd(200) = 2
If Alien#(I,9) = 70
Alien#(I,9) = 290
else
Alien#(I,9) = 70
endif
endif
IF Alien#(I,3) > 10 then Alien#(I,9) = 70
IF Alien#(I,3) < -10 then Alien#(I,9) = 290
zrotate object 9+I,Alien#(I,9)
yrotate object 9+I,90
move object I+9,Alien#(I,6)*-1
yrotate object 9+I,0
zrotate object 9+I,0
Alien#(I,2) = object position x(I+9)
Alien#(I,3) = object position y(I+9)
alien#(I,4) = object angle z(I+9)
If Alien#(I,2) < -30
Alien#(I,1) = 0
Delete object I+9
endif
endif
IF Alien#(I,5) = 7
IF Alien#(I,10) = 0
Select ALien#(I,9)
Case 0
ALien#(I,9) = 2
ALien#(I,11) = 0
Alien#(I,10) = 180
goto goodbyeandstuff
endcase
Case 1
Alien#(I,9) = 2
ALien#(I,11) = 0
Alien#(I,10) = 180
goto goodbyeandstuff
endcase
Case 2
Alien#(I,9) = 1
ALien#(I,11) = 0
Alien#(I,10) = 400
goto goodbyeandstuff
endcase
endselect
endif
goodbyeandstuff:
Alien#(I,10) = Alien#(I,10) - 1
If Alien#(I,9) = 0 then Position object 9+I,curvevalue(25,object position x(I+9),10),0,-1
If alien#(I,9) = 1
If Alien#(I,11) <> 1 and object position y(9+I) < 0.1
Alien#(I,11) = Alien#(I,11) + 0.01
x1=-25
y1=0
vx1=-18
vy1=-31
x2=25
y2=0
vx2=23
vy2=-28
t# = Alien#(I,11)
Position object 9+I,x1*(1-t#)^3 + 3*vx1*(1-t#)^2*t# + 3*vx2*(1-t#)*t#^2 + x2*t#^3,y1*(1-t#)^3 + 3*vy1*(1-t#)^2*t# + 3*vy2*(1-t#)*t#^2 + y2*t#^3,-1
endif
endif
If Alien#(I,9) = 2
If Alien#(I,11) <> 1 and object position y(9+I) > -0.1
Alien#(I,11) = Alien#(I,11) + 0.01
x1=25
y1=0
vx1=18
vy1=31
x2=-25
y2=0
vx2=-23
vy2=28
t# = Alien#(I,11)
Position object 9+I,x1*(1-t#)^3 + 3*vx1*(1-t#)^2*t# + 3*vx2*(1-t#)*t#^2 + x2*t#^3,y1*(1-t#)^3 + 3*vy1*(1-t#)^2*t# + 3*vy2*(1-t#)*t#^2 + y2*t#^3,-1
endif
endif
Point object 9+I,0,0,-1
IF object position x(9+I) > 0 then zrotate object 9+I,object angle x(9+I)
If object position x(9+I) < 0 then zrotate object 9+I,wrapvalue(object angle x(9+I)+180)
yrotate object 9+I,0
xrotate object 9+I,0
Alien#(I,2) = object position x(I+9)
Alien#(I,3) = object position y(I+9)
Alien#(I,4) = object angle z(I+9)
If Alien#(I,2) < -30
Alien#(I,1) = 0
Delete object I+9
endif
endif
If Alien#(I,5) = 8
zrotate object 9+I,Alien#(I,4)
yrotate object 9+I,0
IF I = 2 then Position object 9+I,curvevalue(newxvalue(ALien#(1,2),wrapvalue(ALien#(1,4)+90),1),object position x(I+9),20),curvevalue(newyvalue(Alien#(1,3),wrapvalue(Alien#(1,4)+90),12),object position y(9+I),20),-1
IF I = 3 then Position object 9+I,curvevalue(newxvalue(ALien#(1,2),wrapvalue(ALien#(1,4)+90),1),object position x(I+9),20),curvevalue(newyvalue(Alien#(1,3),wrapvalue(Alien#(1,4)-90),12),object position y(9+I),20),-1
IF I = 4 then Position object 9+I,curvevalue(newxvalue(ALien#(1,2),wrapvalue(ALien#(1,4)+90),3.5),object position x(I+9),20),curvevalue(newyvalue(Alien#(1,3),wrapvalue(Alien#(1,4)+90),10),object position y(9+I),20),-1
IF I = 5 then Position object 9+I,curvevalue(newxvalue(ALien#(1,2),wrapvalue(ALien#(1,4)+90),3.5),object position x(I+9),20),curvevalue(newyvalue(Alien#(1,3),wrapvalue(Alien#(1,4)-90),10),object position y(9+I),20),-1
Alien#(I,2) = object position x(I+9)
Alien#(I,3) = object position y(I+9)
alien#(I,4) = object angle z(I+9)
If Alien#(I,2) < -30
Alien#(I,1) = 0
Delete object I+9
endif
endif
endif
next I
Endfunction
Function Bullet_Collision_ALiens
For I = 1 to 40
If Alien#(I,1) = 1
For x = 1 to 50
If PlayerBullet#(x,1) = 1 and object exist(I+9) = 1
If Alien#(I,2) < PlayerBullet#(x,2)+(object size x(I+9)/2) and Alien#(I,2) > PlayerBullet#(x,2)-(object size x(I+9)/2) and Alien#(I,3) < PlayerBullet#(x,3)+(object size y(I+9)/2) and Alien#(I,3) > PlayerBullet#(x,3)-(object size y(I+9)/2)
If Alien#(I,8) =< 0
Make_Explosion(Alien#(I,2),Alien#(I,3))
For z = 1 to 5
Fireball(Alien#(I,2),Alien#(I,3),wrapvalue(rnd(360)))
next z
IF Alien#(I,5) > 0 and Alien#(I,5) < 4 then Coin_Explosion(Alien#(I,2),Alien#(I,3),1)
If Alien#(I,5) > 3 and Alien#(I,5) < 7 or Alien#(I,5) = 8 then Coin_Explosion(Alien#(I,2),Alien#(I,3),3)
If Alien#(I,5) = 7 then Coin_Explosion(Alien#(I,2),Alien#(I,3),10)
If Camerashake#(2) = 0
If Alien#(I,5) = 4 or Alien#(I,5) = 5 or Alien#(I,5) = 6 or Alien#(I,5) = 8 then Camera_Shake(0.3,20.0)
If Alien#(I,5) = 7 then Camera_Shake(0.8,20.0)
endif
Alien#(I,1) = 0
Position object I+9,0,0,1
If alien#(I,5) = 1 then score(0) = score(0) + 5
If alien#(I,5) = 2 then score(0) = score(0) + 10
If alien#(I,5) = 3 then score(0) = score(0) + 25
If alien#(I,5) = 4 then score(0) = score(0) + 100
If alien#(I,5) = 5 then score(0) = score(0) + 200
If alien#(I,5) = 6 then score(0) = score(0) + 300
If alien#(I,5) = 7
score(0) = score(0) + 2000
Make_explosion(ALien#(I,2),Alien#(I,3))
For I = 1 to 5
Make_explosion(ALien#(I,2)+rnd(10)-5,Alien#(I,3)+rnd(10)-5)
Next I
endif
If alien#(I,5) = 8
Create_Powerup(Alien#(I,2),Alien#(I,3))
score(0) = score(0) + 200
Alien#(1,8) = Alien#(1,8) - 125
important(0) = 1
Make_explosion(ALien#(1,2),Alien#(1,3))
For I = 1 to 5
Make_explosion(ALien#(1,2)+rnd(10)-5,Alien#(1,3)+rnd(10)-5)
Next I
endif
IF int(rnd(30)) = 2 then Create_Powerup(Alien#(I,2),Alien#(I,3))
else
Play sound 3
Alien#(I,8) = Alien#(I,8) - 1
endif
PlayerBullet#(x,1) = 0
Position object x+499,0,0,1
Endif
endif
Next x
endif
next I
Endfunction
Function Load_Explosion
For I = 1 to 16
Load image "media/explosions/"+str$(I)+".bmp",I+99
Next I
For I = 1 to 20
MAke object plain 99+I,7,7
Set object 99+I,1,0,1
Ghost object on 99+I
Hide object 99+I
Position object 99+I,0,0,5
Ghost object on 99+I
position object 99+I,0,0,1
Next I
Endfunction
Function MAke_Explosion(x#,y#)
For I = 1 to 20
IF Explosion#(I,1) = 0
Explosion#(I,1) = 1
Explosion#(I,2) = x#
Explosion#(I,3) = y#
Explosion#(I,4) = 1
Show object 99+I
Play sound 1
goto leavethisexplosionloop
endif
Next I
leavethisexplosionloop:
Endfunction
Function Draw_Explosion
For I = 1 to 20
If Explosion#(I,1) = 1
Position object 99+I,Explosion#(I,2),Explosion#(I,3),-1
Texture object 99+I,int(Explosion#(I,4))+99
Explosion#(I,4) = Explosion#(I,4) + 0.3
If explosion#(I,4) > 17
explosion#(I,1) = 0
Position object 99+I,0,0,5
Hide object 99+I
endif
ENdif
Next I
Endfunction
Function Load_Sounds
Load sound "media/sound/explode.wav",1
Load sound "media/sound/explode3.wav",2
Load sound "media/sound/hit.wav",3
Load sound "media/sound/playerGun.wav",5
Load sound "media/sound/lasergun.wav",6
Load sound "media/sound/launch.wav",7
Load sound "media/sound/powerup.wav",10
Load sound "media/sound/powerup over.wav",11
Load sound "media/sound/coin.wav",12
Endfunction
Function Load_Music
` Load music "media/music/1.mp3",1
` Load music "media/music/2.mp3",2
` Load music "media/music/3.mp3",3
` Load music "media/music/4.mp3",4
Endfunction
Function Load_Enemy_Bullets
Load image "media/laser.bmp",1002
For I = 1 to 50
Make object plain 599+I,1.3,1.3
Texture object 599+I,1002
Set object 599+I,1,0,1
Ghost object on 599+I
position object 599+I,0,0,1
Next I
Endfunction
Function Load_Enemy_Missles
Load image "media/missle.bmp",1003
For I = 1 to 50
Make object plain 699+I,2,1
If I < 26 then Texture object 699+I,1003
If I < 26 then Set object 699+I,1,0,1
hide object 699+I
Ghost object on 699+I
position object 699+I,0,0,1
Next I
Endfunction
Function Load_Enemy_flames
For I = 1 to 50
Make object plain 799+I,1.5,1.5
Color object 799+I,rgb(rnd(155)+100,rnd(100)+10,0)
hide object 799+I
Ghost object on 799+I
position object 799+I,0,0,1
Next I
Endfunction
Function ALien_Shoot
For I = 1 to 40
IF Alien#(I,1) = 1
ALien#(I,7) = ALien#(I,7) - 5
If Alien#(I,7) < 0
If ALien#(I,5) = 1 then Alien#(I,7) = 500+(rnd(100)-50)
If ALien#(I,5) = 2 then Alien#(I,7) = 250+(rnd(120)-60)
If ALien#(I,5) = 3 then Alien#(I,7) = 240+(rnd(60)-30)
If Alien#(I,5) = 4 then Alien#(I,7) = 100+(rnd(50)-25)
If Alien#(I,5) = 5 then Alien#(I,7) = 240+(rnd(200)-100)
If Alien#(I,5) = 6 then Alien#(I,7) = 75
If Alien#(I,5) = 7 then Alien#(I,7) = 150
If ALien#(I,5) = 1 then Ashoot(Alien#(I,2),Alien#(I,3),180+(rnd(80)-40))
If ALien#(I,5) = 2 then Ashoot(Alien#(I,2),Alien#(I,3),int(wrapvalue(Alien#(I,4)+180)))
If ALien#(I,5) = 3 then Ashoot(Alien#(I,2),Alien#(I,3),int(wrapvalue(rnd(360))))
If ALien#(I,5) = 4 then AMissle(Alien#(I,2),Alien#(I,3)-1,int(wrapvalue(rnd(20))))
If ALien#(I,5) = 5
AMissle(newxvalue(ALien#(I,2),wrapvalue(Alien#(I,4)+90),2),newyvalue(ALien#(I,3),wrapvalue(Alien#(I,4)+90),2),int(wrapvalue(Alien#(I,4)+180)))
AMissle(newxvalue(ALien#(I,2),wrapvalue(Alien#(I,4)-90),2),newyvalue(ALien#(I,3),wrapvalue(Alien#(I,4)-90),2),int(wrapvalue(Alien#(I,4)+180)))
Ashoot(Alien#(I,2),Alien#(I,3),int(wrapvalue(Alien#(I,4)-10)))
Ashoot(Alien#(I,2),Alien#(I,3),int(wrapvalue(Alien#(I,4)+10)))
Ashoot(Alien#(I,2),Alien#(I,3),int(wrapvalue(Alien#(I,4))))
endif
If Alien#(I,5) = 6
If Alien#(I,10) > 0
AFlame(Alien#(I,2),Alien#(I,3)-1,int(wrapvalue(Alien#(I,4)-20)))
AFlame(Alien#(I,2),Alien#(I,3)-1,int(wrapvalue(Alien#(I,4)+20)))
AFlame(Alien#(I,2),Alien#(I,3)-1,int(wrapvalue(Alien#(I,4))))
endif
Alien#(I,10) = Alien#(I,10) - 1
IF ALien#(I,10) = -15 then Alien#(I,10) = 5
endif
If ALien#(I,5) = 7
Alien#(I,12) = Alien#(I,12)+1
If Alien#(I,12) > 10 and Alien#(I,12) < 20
thingy# = 100
AFlame(Alien#(I,2),newyvalue(ALien#(I,3),wrapvalue(Alien#(I,4)+90),8),int(wrapvalue(Alien#(I,4))))
AFlame(Alien#(I,2),newyvalue(ALien#(I,3),wrapvalue(Alien#(I,4)+90),8),int(wrapvalue(Alien#(I,4)-20)))
AFlame(Alien#(I,2),newyvalue(ALien#(I,3),wrapvalue(Alien#(I,4)+90),8),int(wrapvalue(Alien#(I,4)-40)))
AFlame(Alien#(I,2),newyvalue(ALien#(I,3),wrapvalue(Alien#(I,4)-90),8),int(wrapvalue(Alien#(I,4))))
AFlame(Alien#(I,2),newyvalue(ALien#(I,3),wrapvalue(Alien#(I,4)-90),8),int(wrapvalue(Alien#(I,4)+20)))
AFlame(Alien#(I,2),newyvalue(ALien#(I,3),wrapvalue(Alien#(I,4)-90),8),int(wrapvalue(Alien#(I,4)+40)))
AFlame(Alien#(I,2),Alien#(I,3),int(ALien#(I,4)))
AFlame(Alien#(I,2),Alien#(I,3),int(wrapvalue(ALien#(I,4)+20)))
AFlame(Alien#(I,2),Alien#(I,3),int(wrapvalue(ALien#(I,4)-20)))
endif
If Alien#(I,12) > 20 and Alien#(I,12) < 30
Ashoot(ALien#(I,2),newyvalue(Alien#(I,3),wrapvalue(Alien#(I,4)+90),8),int(wrapvalue(Alien#(I,4)+rnd(60)+150)))
Ashoot(ALien#(I,2),newyvalue(Alien#(I,3),wrapvalue(Alien#(I,4)+90),6),int(wrapvalue(Alien#(I,4)+rnd(60)+150)))
Ashoot(ALien#(I,2),newyvalue(Alien#(I,3),wrapvalue(Alien#(I,4)+90),4),int(wrapvalue(Alien#(I,4)+rnd(60)+150)))
Ashoot(ALien#(I,2),newyvalue(Alien#(I,3),wrapvalue(Alien#(I,4)+90),2),int(wrapvalue(Alien#(I,4)+rnd(60)+150)))
Ashoot(ALien#(I,2),newyvalue(Alien#(I,3),wrapvalue(Alien#(I,4)+90),0),int(wrapvalue(Alien#(I,4)+rnd(60)+150)))
Ashoot(ALien#(I,2),newyvalue(Alien#(I,3),wrapvalue(Alien#(I,4)+90),-2),int(wrapvalue(Alien#(I,4)+rnd(60)+150)))
Ashoot(ALien#(I,2),newyvalue(Alien#(I,3),wrapvalue(Alien#(I,4)+90),-4),int(wrapvalue(Alien#(I,4)+rnd(60)+150)))
Ashoot(ALien#(I,2),newyvalue(Alien#(I,3),wrapvalue(Alien#(I,4)+90),-6),int(wrapvalue(Alien#(I,4)+rnd(60)+150)))
Ashoot(ALien#(I,2),newyvalue(Alien#(I,3),wrapvalue(Alien#(I,4)+90),-8),int(wrapvalue(Alien#(I,4)+rnd(60)+150)))
endif
If Alien#(I,12) > 30 and Alien#(I,12) < 40
AMissle(Alien#(I,2),newyvalue(ALien#(I,3),wrapvalue(Alien#(I,4)+90),8),int(wrapvalue(Alien#(I,4))))
AMissle(Alien#(I,2),newyvalue(ALien#(I,3),wrapvalue(Alien#(I,4)+270),8),int(wrapvalue(Alien#(I,4))))
AMissle(Alien#(I,2),newyvalue(ALien#(I,3),wrapvalue(Alien#(I,4)+90),1),int(wrapvalue(Alien#(I,4))))
AMissle(Alien#(I,2),newyvalue(ALien#(I,3),wrapvalue(Alien#(I,4)+270),1),int(wrapvalue(Alien#(I,4))))
endif
If ALien#(I,12) > 30 and Alien#(I,12) < 40
AShoot(Alien#(I,2),newyvalue(ALien#(I,3),wrapvalue(Alien#(I,4)+90),8),int(wrapvalue(Alien#(I,4))))
AShoot(Alien#(I,2),newyvalue(ALien#(I,3),wrapvalue(Alien#(I,4)+90),8),int(wrapvalue(Alien#(I,4)-rnd(20))))
AShoot(Alien#(I,2),newyvalue(ALien#(I,3),wrapvalue(Alien#(I,4)+90),8),int(wrapvalue(Alien#(I,4)-rnd(20)+20)))
AShoot(Alien#(I,2),newyvalue(ALien#(I,3),wrapvalue(Alien#(I,4)-90),8),int(wrapvalue(Alien#(I,4))))
AShoot(Alien#(I,2),newyvalue(ALien#(I,3),wrapvalue(Alien#(I,4)-90),8),int(wrapvalue(Alien#(I,4)+rnd(20))))
AShoot(Alien#(I,2),newyvalue(ALien#(I,3),wrapvalue(Alien#(I,4)-90),8),int(wrapvalue(Alien#(I,4)+rnd(20)+20)))
AShoot(Alien#(I,2),Alien#(I,3),int(ALien#(I,4)))
AShoot(Alien#(I,2),Alien#(I,3),int(wrapvalue(ALien#(I,4)+rnd(20))))
AShoot(Alien#(I,2),Alien#(I,3),int(wrapvalue(ALien#(I,4)-rnd(20))))
AFlame(Alien#(I,2),Alien#(I,3),int(ALien#(I,4)))
AFlame(Alien#(I,2),Alien#(I,3),int(wrapvalue(ALien#(I,4)+20)))
AFlame(Alien#(I,2),Alien#(I,3),int(wrapvalue(ALien#(I,4)-20)))
endif
IF Alien#(I,12) = 41 then Alien#(I,12) = 0
endif
endif
endif
NExt I
Endfunction
Function Ashoot(x#,y#,angle)
For I = 1 to 50
IF AlienBullet#(I,1) = 0
AlienBullet#(I,1) = 1
AlienBullet#(I,2) = x#
AlienBullet#(I,3) = y#
ALienBullet#(I,4) = angle
SHow object 599+I
Play sound 6
goto leavethisalienshoot
endif
NExt I
leavethisalienshoot:
Endfunction
Function Amissle(x#,y#,angle)
For I = 1 to 25
IF AlienMissle#(I,1) = 0
AlienMissle#(I,1) = 1
AlienMissle#(I,2) = x#
AlienMissle#(I,3) = y#
ALienMissle#(I,4) = wrapvalue(angle+180)
SHow object 699+I
Play sound 7
goto leavethisalienshoot
endif
NExt I
leavethisalienshoot:
Endfunction
Function AFlame(x#,y#,angle)
For I = 1 to 50
IF AlienFlame#(I,1) = 0
AlienFlame#(I,1) = 1
AlienFlame#(I,2) = x#
AlienFlame#(I,3) = y#
ALienFlame#(I,4) = wrapvalue(angle+180)
AlienFlame#(I,5) = wrapvalue(360)
SHow object 799+I
goto leavethisalienshoot
endif
NExt I
leavethisalienshoot:
Endfunction
Function Move_Enemy_Bullets
For I = 1 to 50
If ALienBullet#(I,1) = 1
Position object 599+I,AlienBullet#(I,2),AlienBullet#(I,3),-1
zrotate object 599+I,AlienBullet#(I,4)
yrotate object 599+I,90
move object I+599,0.5
yrotate object 599+I,0
zrotate object 599+I,0
ALienbullet#(I,2) = object position x(599+I)
ALienbullet#(I,3) = object position y(599+I)
IF Alienbullet#(I,2) < -40 or Alienbullet#(I,2) > 40 or Alienbullet#(I,3) < -17 or ALienbullet#(I,3) > 17
Alienbullet#(I,1) = 0
hide object 599+I
endif
Endif
Next I
Endfunction
Function Move_Enemy_Missles
For I = 1 to 25
If ALienmissle#(I,1) = 1
Position object 699+I,Alienmissle#(I,2),Alienmissle#(I,3),-1
Position object 724+I,Alienmissle#(I,2),Alienmissle#(I,3),1
Point object 724+I,object position x(1),object position y(1),-1
IF object angle x(724+I) > wrapvalue(object angle z(699+I)+180) then ALienmissle#(I,4) = wrapvalue(Alienmissle#(I,4) - 2)
IF object angle x(724+I) < wrapvalue(object angle z(699+I)+180) then ALienmissle#(I,4) = wrapvalue(Alienmissle#(I,4) + 2)
zrotate object 699+I,Alienmissle#(I,4)
yrotate object 699+I,90
move object I+699,0.5
yrotate object 699+I,0
zrotate object 699+I,wrapvalue(Alienmissle#(I,4)+180)
ALienmissle#(I,2) = object position x(699+I)
ALienmissle#(I,3) = object position y(699+I)
IF Alienmissle#(I,2) < -40 or Alienmissle#(I,2) > 40 or Alienmissle#(I,3) < -17 or ALienmissle#(I,3) > 17
Alienmissle#(I,1) = 0
hide object 699+I
hide object 724+I
endif
Endif
Next I
Endfunction
Function Move_Enemy_Flames
For I = 1 to 50
If ALienFlame#(I,1) = 1
Position object 799+I,Alienflame#(I,2),AlienFlame#(I,3),-1
zrotate object 799+I,AlienFlame#(I,4)
yrotate object 799+I,90
move object I+799,0.5
yrotate object 799+I,0
zrotate object 799+I,ALienFlame#(I,5)
AlienFlame#(I,5) = wrapvalue(AlienFlame#(I,5)-5)
ALienFlame#(I,2) = object position x(799+I)
ALienFlame#(I,3) = object position y(799+I)
IF AlienFlame#(I,2) < -40 or AlienFlame#(I,2) > 40 or AlienFlame#(I,3) < -17 or ALienFlame#(I,3) > 17
AlienFlame#(I,1) = 0
hide object 799+I
endif
Endif
Next I
Endfunction
Function Player_Alien_Collision
For I = 1 to 40
If object exist(I+9) = 1
IF object position z(I+9) = -1
If Alien#(I,2) < object position x(1)+(object size x(I+9)/2) and Alien#(I,2) > object position x(1)-(object size x(I+9)/2) and Alien#(I,3) < object position y(1)+(object size y(I+9)/2) and Alien#(I,3) > object position y(1)-(object size y(I+9)/2)
IF sheild(0) < 5
Health(0) = Health(0) - 1
Drain(1) = Drain(1) + 7
Drain(2) = Sheild(0) * 4
sheild(0) = 0
else
sheild(0) = 0
Drain(2) = Drain(2) + 30
endif
If Alien#(I,5) = 7
Health(0) = 0
Sheild(0) = 0
endif
Play sound 2
Camera_Shake(0.3,20.0)
Make_Explosion(object position x(1),Object position y(1))
Alien#(I,1) = 0
Position object I+9,0,0,1
endif
endif
endif
Next I
Endfunction
Function Alien_Bullet_Collision_Player
For I = 1 to 50
If AlienBullet#(I,1) = 1
If AlienBullet#(I,2) < object position x(1)+ 2 and AlienBullet#(I,2) > object position x(1)-2
If AlienBullet#(I,3) < object position y(1)+ 1.5 and AlienBullet#(I,3) > object position y(1)-1.5
IF sheild(0) < 5
Health(0) = Health(0) - 1
Drain(1) = Drain(1) + 7
Drain(2) = Sheild(0) * 4
sheild(0) = 0
else
sheild(0) = 0
Drain(2) = Drain(2) + 25
endif
Play sound 2
Camera_Shake(0.3,20.0)
Make_Explosion(object position x(1),Object position y(1))
AlienBullet#(I,1) = 0
Position object I+599,0,0,1
Endif
endif
endif
Next I
Endfunction
Function Alien_Flame_Collision_Player
For I = 1 to 50
If AlienFlame#(I,1) = 1 and object exist(I+799) = 1
If AlienFlame#(I,2) < object position x(1)+2 and AlienFlame#(I,2) > object position x(1)-2
If AlienFlame#(I,3) < object position y(1)+1.5 and AlienFlame#(I,3) > object position y(1)-1.5
IF sheild(0) < 5
Health(0) = Health(0) - 1
Drain(1) = Drain(1) + 7
Drain(2) = Sheild(0) * 4
sheild(0) = 0
else
sheild(0) = 0
Drain(2) = Drain(2) + 25
endif
Play sound 2
Camera_Shake(0.3,20.0)
Make_Explosion(object position x(1),Object position y(1))
AlienFlame#(I,1) = 0
Position object I+799,0,0,1
Endif
endif
endif
Next I
Endfunction
Function Missle_Collision_Player
For I = 1 to 25
If AlienMissle#(I,1) = 1
IF Alienmissle#(I,2) < object position x(1)+3 and AlienMissle#(I,2) > object position x(1)-3
IF Alienmissle#(I,3) < object position x(1)+2 and AlienMissle#(I,3) > object position x(1)-2
Position object I+724,0,0,1
hide object 699+I
IF sheild(0) < 5
Health(0) = Health(0) - 1
Drain(1) = Drain(1) + 7
Drain(2) = Sheild(0) * 4
sheild(0) = 0
else
sheild(0) = 0
Drain(2) = Drain(2) + 25
endif
Play sound 2
Camera_Shake(0.3,20.0)
Make_Explosion(object position x(1),Object position y(1))
AlienMissle#(I,1) = 0
endif
endif
endif
Next I
Endfunction
Function Load_Powerups
Load image "media/powerups/pod.bmp",200
Load image "media/powerups/Weapon Upgrade.bmp",201
Load image "media/powerups/health.bmp",202
Load image "media/powerups/star.bmp",203
For I = 1 to 3
Make object plain 209+I,2,2
Set object 209+I,1,0,1
Ghost object on 209+I
position object 209+I,0,0,1
Next I
Endfunction
Function Load_Pods
Load image "media/pod.bmp",1004
For I = 1 to 4
MAke object plain 199+I,1,1
Texture object 199+I,1004
Set object 199+I,1,0,1
Ghost object on 199+I
position object 199+I,0,0,1
Next I
Endfunction
Function Position_pods
If pods(0) > 0
Position object 200,curvevalue(object position x(1),object position x(200),10),curvevalue(object position y(1)-2,object position y(200),10),-1
zrotate object 200,curveangle(0,object angle z(200),30)
If pods(0) > 1
Position object 201,curvevalue(object position x(1),object position x(201),10),curvevalue(object position y(1)+2,object position y(201),10),-1
zrotate object 201,curveangle(0,object angle z(201),30)
If pods(0) > 2
Position object 202,curvevalue(object position x(1)-2,object position x(202),10),curvevalue(object position y(1)-4,object position y(202),10),-1
zrotate object 202,curveangle(0,object angle z(202),30)
If pods(0) > 3
Position object 203,curvevalue(object position x(1)-2,object position x(203),10),curvevalue(object position y(1)+4,object position y(203),10),-1
zrotate object 203,curveangle(0,object angle z(203),30)
endif
endif
endif
endif
Endfunction
Function Create_Powerup(x#,y#)
For I = 1 to 3
If Powerup#(I,1) = 0
Powerup#(I,1) = 1
Powerup#(I,2) = x#
Powerup#(I,3) = y#
powerup#(I,4) = rnd(3)+1
If important(0) = 1
powerup#(I,4) = 3
important(0) = 0
endif
Texture object 209+I,199+Powerup#(I,4)
goto leavepoweruploop
Endif
Next I
leavepoweruploop:
Endfunction
Function Move_Powerups
For I = 1 to 3
If powerup#(I,1) = 1
Powerup#(I,2) = Powerup#(I,2) - 0.2
Position object 209+I,Powerup#(I,2),Powerup#(I,3),-1
If powerup#(I,2) < -35
powerup#(I,1) = 0
endif
endif
Next I
Endfunction
function Powerup_Collision
for I = 1 to 3
If powerup#(I,1) = 1
If Powerup#(I,2) < object position x(1)+(object size x(1)/2) and Powerup#(I,2) > object position x(1)-(object size x(1)/2)
If Powerup#(I,3) < object position y(1)+(object size y(1)/2) and Powerup#(I,3) > object position y(1)-(object size y(1)/2)
If powerup#(I,4) = 1 and pods(0) < 4
Pods(0) = pods(0) + 1
Position object 199+pods(0),powerup#(I,2),powerup#(I,3),-1
play sound 10
endif
If powerup#(I,4) = 2
IF shoot_status(0) < 5 then shoot_status(0) = shoot_status(0) + 1
play sound 10
endif
If powerup#(I,4) = 3
Health(0) = Health(0) + 3
IF health(0) > 10 then Health(0) = 10
play sound 10
endif
If powerup#(I,4) = 4
Star(0) = 3000
play sound 10
endif
powerup#(I,1) = 0
position object 209+I,0,0,1
Endif
endif
endif
next I
endfunction
Function Load_Coins
Load image "media/coin.bmp",1005
For I = 900 to 950
Make object plain I,1,1
Texture object I,1005
Set object I,1,0,1
Next I
Endfunction
Function Coin_Explosion(x#,y#,amount)
For I = 1 to amount
For x = 1 to 50
If Coin#(x,1) = 0
Coin#(x,1) = 1
Coin#(x,2) = x#
Coin#(x,3) = y#
Coin#(x,4) = wrapvalue(rnd(360))
Coin#(x,5) = 1
Position object 899+x,x#,y#,-1
goto leavethiscoin
endif
Next x
leavethiscoin:
Next I
Endfunction
Function Move_Coins
For I = 1 to 50
If Coin#(I,1) = 1
If object position x(899+I) > 30 then Coin#(I,1) = 0
If object position x(899+I) < -30 then Coin#(I,1) = 0
If object position y(899+I) > 16 then Coin#(I,1) = 0
If object position y(899+I) < -16 then Coin#(I,1) = 0
If object position z(899+I) < -30 then Coin#(I,1) = 0
If coin#(I,1) = 0 then position object 899+I,0,0,1
IF Coin#(I,5) = 1
Coin#(I,4) = curveangle(180,coin#(I,4),10)
zrotate object 899+I,Coin#(I,4)
yrotate object 899+I,90
move object I+899,0.5
yrotate object 899+I,0
zrotate object 899+I,0
Coin#(I,2) = object position x(899+I)
Coin#(I,3) = Object position y(899+I)
endif
If Coin#(I,5) = 2
zrotate object 899+I,0
yrotate object 899+I,0
Position object 899+I,Coin#(I,2),Coin#(I,3),object position z(899+I)-1
Coin#(I,2) = object position x(899+I)
Coin#(I,3) = Object position y(899+I)
endif
endif
Next I
Endfunction
Function Coin_Collision
For I = 1 to 50
If coin#(I,1) = 1 and coin#(I,5) = 1
If Coin#(I,2) < object position x(1)+(object size x(1)/2) and Coin#(I,2) > object position x(1)-(object size x(1)/2)
If Coin#(I,3) < object position y(1)+(object size y(1)/2) and Coin#(I,3) > object position y(1)-(object size y(1)/2)
Coin#(I,5) = 2
score(0) = score(0) + 50
play sound 12
endif
endif
endif
Next I
Endfunction
Function Camera_Shake(amount#,time#)
Camerashake#(1) = amount#
Camerashake#(2) = time#
endfunction
Function Update_Shake
IF Camerashake#(2) > 0
camerashake#(2) = camerashake#(2) - 1
If camerashake#(2) < 20 then camerashake#(1) = curvevalue(0,camerashake#(1),20)
IF camera position x() <> 0
x# = 0
else
x# = rnd(camerashake#(1)*2)-camerashake#(1)
endif
IF camera position y() <> 0
y# = 0
else
y# = rnd(camerashake#(1)*2)-camerashake#(1)
endif
IF camera position z() <> -38
z# = -38
else
z# = -38+rnd(camerashake#(1)*2)-camerashake#(1)
endif
position camera x#,y#,z#
endif
Endfunction
Function Fireball(x#,y#,dir#)
For I = 1 to 75
If Fireball#(I,1) = 0
Fireball#(I,1) = 1
Fireball#(I,2) = x#
Fireball#(I,3) = y#
Fireball#(I,4) = dir#
Fireball#(I,5) = 100
Position object 299+I,x#,y#,-0.5
show object 299+I
fade object I+299,100
goto leavefireball
endif
next I
leavefireball:
endfunction
Function Load_Fireballs
Load image "media/fireball.jpg",1006
For I = 300 to 374
Make object plain I,1,1
Texture object I,1006
Set object I,1,0,1
Ghost object on I
hide object I
next I
Endfunction
Function Move_Fireballs
For I = 1 to 75
If fireball#(I,1) = 1
Fireball#(I,5) = Fireball#(I,5) - 2.5
Position object 299+I,fireball#(I,2),fireball#(I,3),-0.5
zrotate object 299+I,fireball#(I,4)
yrotate object 299+I,90
move object I+299,0.2
yrotate object 299+I,0
zrotate object 299+I,0
fireball#(I,2) = object position x(299+I)
fireball#(I,3) = object position y(299+I)
IF fireball#(I,2) < -40 or fireball#(I,2) > 40 or fireball#(I,3) < -17 or fireball#(I,3) > 17 or fireball#(I,5) = 0
fireball#(I,1) = 0
hide object 299+I
endif
endif
Next I
Endfunction
Function Menu
Load image "media/menu/UFOGAMES.png",13
Paste image 13,0,0
sleep 4000
Load image "media/menu/play.png",10
Load image "media/menu/help.png",11
Load image "media/menu/quit.png",12
For I = 1 to 7
Load image "media/menu/help"+str$(I)+".png",12+I
Next I
Make object plain 70,3,3
Texture object 70,10
Position object 70,0,-50,-33
Make object plain 71,3,3
Texture object 71,11
Position object 71,5,-50,-33
Make object plain 72,3,3
Texture object 72,12
Position object 72,10,-50,-33
Make object plain 73,20,20
Position object 73,5,-90,-21
Texture object 73,13
Load_Background(1)
Position camera 0,-35,-38
color backdrop rgb(0,0,0)
happyme:
selection = 1
Do
If rightkey() = 1 and selection = 1 and key = 0
selection = 2
key = 1
endif
If rightkey() = 1 and selection = 2 and key = 0
selection = 3
key = 1
endif
If leftkey() = 1 and selection = 3 and key = 0
selection = 2
key=1
endif
If leftkey() = 1 and selection = 2 and key = 0
selection = 1
key = 1
endif
If rightkey() = 0 and leftkey() = 0 then key = 0
If returnkey() = 1 and selection = 1 then selection = 4
IF returnkey() = 1 and selection = 2 then selection = 5
If returnkey() = 1 and selection = 3 then end
If selection = 1 then position camera curvevalue(0,camera position x(),20),-50,-38
If selection = 2 then position camera curvevalue(5,camera position x(),20),-50,-38
If selection = 3 then position camera curvevalue(10,camera position x(),20),-50,-38
If selection = 4 then position camera 0,camera position y()+0.5,camera position z()
If selection = 5 then position camera 5,camera position y()-0.5,camera position z()
If camera position y() = 0 then goto leavemenu
If camera position y() = -90 then goto helpme
sync
Loop
helpme:
help = 1
Do
Texture object 73,12+help
If upkey() = 1 and key = 0
help = help - 1
key = 1
endif
If downkey() = 1 and key = 0
help = help + 1
key = 1
endif
If returnkey() = 1 then goback = 1
IF goback = 1 then position camera 5,camera position y()+0.5,camera position z()
If camera position y() = -50
goback = 0
goto happyme
endif
If help = 0 then help = 1
If help = 8 then help = 7
If upkey() = 0 and downkey() = 0 then key = 0
sync
Loop
leavemenu:
Endfunction
Function Setup_HUD
Ink 0,0
Box 1,1,639,80
Box 1,400,639,479
Paste image 5,100,2
Ink rgb(0,255,0),0
Box 190,35,190+(health(0)*7)+Drain(1)+int(Add#(1)),45
Ink rgb(0,0,255),0
Box 190,10,190+(sheild(0)*7)+Drain(2)+int(Add#(2)),20
If energy(0) < 50 then ink rgb(255,0,0),0
IF energy(0) > 50 then Ink rgb(255,255,0),0
If energy(0) > 75 then ink rgb(0,255,0),0
Box 190,58,190+(energy(0))+Drain(3)+int(Add#(3)),68
Ink rgb(255,0,0),0
Set Text Font "Bank Gothic Medium BT"
Set text size 20
center Text 393,30,str$(score(0))
Center text 430,55,str$(Shoot_Status(0))
Endfunction
(Music removed because of file size. Get the music from the LA3 download in my website.)