summaryrefslogtreecommitdiff
path: root/missile_lock.bmx
diff options
context:
space:
mode:
Diffstat (limited to 'missile_lock.bmx')
-rw-r--r--missile_lock.bmx174
1 files changed, 154 insertions, 20 deletions
diff --git a/missile_lock.bmx b/missile_lock.bmx
index f4a4652..ebd5017 100644
--- a/missile_lock.bmx
+++ b/missile_lock.bmx
@@ -64,12 +64,14 @@ SetAlpha(1.0)
'
GFX.Init() ' MUST be first
-Lookup.Init()
GameConfig.Load()
Scroller.Init()
+Thanks.Init()
Particles.Init()
Backdrop.Init()
Trail.Init()
+MissileSet.Init()
+AsteroidSet.Init()
Global quit:Int=False
@@ -82,23 +84,147 @@ Menu()
While Not quit
GameState.Reset()
+ MissileSet.StartLevel()
+ AsteroidSet.StartLevel()
- While Not KeyHit(KEY_ESCAPE)
- Cls
+ While Not GameState.game_over
+
+ While Not GameState.game_over And Not MissileSet.AllDestroyed()
+ Cls()
+ ResetCollisions()
+
+ Backdrop.Draw()
+ Particles.Draw()
+ Trail.Draw()
+
+ GameState.Display()
+ GameState.Control()
+ GameState.Move()
+
+ SetRotation(GameState.ang)
+
+ If GameState.shield
+ SetColor(Rand(0,255),Rand(0,255),Rand(0,255))
+ Else
+ SetColor(255,255,255)
+ EndIf
+
+ DrawImage(GFX.ship,GameState.x,GameState.y)
+ SetRotation(0)
+
+ MissileSet.Update()
+ AsteroidSet.Update()
+
+ Local col:Object[]=CollideImage(GFX.ship,GameState.x,GameState.y,0,ALL_LAYERS,0)
+
+ If Not GameState.shield Then
+ If col
+ GameState.ShieldDown()
+ Particles.AddExplosion(GameState.x,GameState.y)
+ For Local m:Missile=EachIn col
+ If m
+ MissileSet.RemoveMissile(m)
+ GameState.AddScore(1*GameState.level)
+ Exit
+ EndIf
+ Next
+ EndIf
+ EndIf
+
+ Flip(1)
+ Wend
+
+ If Not GameState.game_over
+ AsteroidSet.Nuke()
+
+ Local bonus=100*GameState.level
+ Local added:Int=0
+ Local timer:Int=Max(HERTZ*5,bonus/10+HERTZ*3)
+
+ If Not GameState.hit
+ GameState.AddScore(500*GameState.level)
+ EndIf
+
+ While timer And Not KeyHit(KEY_ESCAPE)
+ Cls()
+ ResetCollisions()
+
+ GameState.ShieldShip()
+
+ Backdrop.Draw()
+ Particles.Draw()
+ Trail.Draw()
+
+ GameState.Display()
+ GameState.Control()
+ GameState.Move()
+
+ SetRotation(GameState.ang)
+
+ If GameState.shield
+ SetColor(Rand(0,255),Rand(0,255),Rand(0,255))
+ Else
+ SetColor(255,255,255)
+ EndIf
+
+ DrawImage(GFX.ship,GameState.x,GameState.y)
+ SetRotation(0)
+
+ GFX.font.Centre("LEVEL " + GameState.level + " COMPLETED!",200,255,255,0)
+
+ GFX.font.Centre("BONUS " + Number.Format(added) + "!!!",400,255,255,0)
+
+ If Not GameState.hit
+ GFX.font.Centre("PERFECT BONUS " + (500*GameState.level) + "!!!",420,255,255,0)
+ EndIf
+
+ If added<bonus
+ GameState.AddScore(10)
+ added:+10
+ EndIf
+
+ If timer<HERTZ*2
+ GFX.font.Centre("GET READY!",300)
+ EndIf
+
+ Flip(1)
+ timer:-1
+ Wend
+
+ GameState.AddScore(bonus-added)
+
+ GameState.LevelUp()
+ MissileSet.StartLevel()
+ AsteroidSet.StartLevel()
+ EndIf
+ Wend
+
+ GameConfig.Save()
+
+ MissileSet.Nuke()
+ AsteroidSet.Nuke()
+ Particles.AddBigExplosion(GameState.x,GameState.y)
+
+ FlushKeys()
+ Local timer:Int=0
+
+ While Not KeyHit(KEY_SPACE) And Not KeyHit(KEY_ESCAPE) And timer<HERTZ*5
+ Cls()
+
Backdrop.Draw()
Particles.Draw()
Trail.Draw()
+
GameState.Display()
- GameState.Control()
- GameState.Move()
- SetRotation(GameState.ang)
- DrawImage(GFX.ship,GameState.x,GameState.y)
- SetRotation(0)
+
+ SetScale(3,3)
+ GFX.font.Centre("GAME OVER!",280)
+ SetScale(1,1)
Flip(1)
+
+ timer:+1
Wend
- GameConfig.Save()
-
TFadeScreen.DoFadeOut()
Menu()
@@ -133,7 +259,6 @@ Function Menu()
Local defkey:Int=0
Particles.Clear()
- GameState.Reset()
While Not done
Cls
@@ -145,14 +270,14 @@ Function Menu()
Backdrop.Draw()
Particles.Draw()
GameState.Display()
- Scroller.Draw()
+ Scroller.Draw(560)
SetColor(255,255,255)
DrawImage(GFX.title,0,0)
If defkey>0
- If defkey=4
+ If defkey=5
GFX.font.Centre("PRESS A KEY TO GO BACK TO THE MENU",380)
Else
GFX.font.Centre("DEFINE KEYS",350)
@@ -162,13 +287,16 @@ Function Menu()
Local c1:Int=128+128*(defkey=1)
Local c2:Int=128+128*(defkey=2)
Local c3:Int=128+128*(defkey=3)
+ Local c4:Int=128+128*(defkey=4)
GFX.font.Draw("LEFT",250,200,c1,c1,c1)
GFX.font.Draw("RIGHT",250,220,c2,c2,c2)
- GFX.font.Draw("PAUSE",250,240,c3,c3,c3)
+ GFX.font.Draw("THRUST",250,240,c3,c3,c3)
+ GFX.font.Draw("PAUSE",250,260,c4,c4,c4)
GFX.font.Draw(KeySym(GameConfig.kleft),500,200,c1,c1,0)
GFX.font.Draw(KeySym(GameConfig.kright),500,220,c2,c2,0)
- GFX.font.Draw(KeySym(GameConfig.kpause),500,240,c3,c3,0)
+ GFX.font.Draw(KeySym(GameConfig.kthrust),500,240,c3,c3,0)
+ GFX.font.Draw(KeySym(GameConfig.kpause),500,260,c4,c4,0)
Local k:Int=-1
@@ -190,12 +318,14 @@ Function Menu()
Case 2
GameConfig.kright=k
Case 3
+ GameConfig.kthrust=k
+ Case 4
GameConfig.kpause=k
End Select
defkey:+1
- If defkey=5
+ If defkey=6
GameConfig.Save()
defkey=0
FlushKeys()
@@ -207,7 +337,7 @@ Function Menu()
quit=True
EndIf
- If KeyHit(KEY_SPACE)
+ If KeyHit(GameConfig.kthrust)
done=True
EndIf
@@ -217,11 +347,15 @@ Function Menu()
EndIf
GFX.font.Centre("COPYRIGHT (C) NODDYBOX 2006",200)
+ GFX.font.Centre("HTTP://WWW.NODDYBOX.CO.UK/",226)
+
+ GFX.font.Centre("THANKS TO",300)
+ Thanks.Draw(326)
- GFX.font.Centre("PRESS SPACE TO PLAY",300)
+ GFX.font.Centre("PRESS THRUST TO PLAY",400)
- GFX.font.Centre("PRESS R TO REDEFINE KEYS",380)
- GFX.font.Centre("PRESS ESCAPE TO QUIT",400)
+ GFX.font.Centre("PRESS R TO REDEFINE KEYS",480)
+ GFX.font.Centre("PRESS ESCAPE TO QUIT",500)
EndIf
If fade