summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2006-05-02 22:50:22 +0000
committerIan C <ianc@noddybox.co.uk>2006-05-02 22:50:22 +0000
commit1c900457e45e70e12a04b2c5b909e0bd9a9d8a3e (patch)
tree156ccafdee5dcea718f8b7a3930c38a9158749b1
parentc93d5990b230175597557978d0bc2c094bee3bdb (diff)
Updates
-rw-r--r--GFX/fireball.pngbin0 -> 272 bytes
-rw-r--r--GFX/sprites.bmsbin3187 -> 4235 bytes
-rw-r--r--gametypes.bmx33
-rw-r--r--global.bmx73
-rw-r--r--missile_lock.bmx38
-rw-r--r--particle.bmx2
6 files changed, 125 insertions, 21 deletions
diff --git a/GFX/fireball.png b/GFX/fireball.png
new file mode 100644
index 0000000..850fa15
--- /dev/null
+++ b/GFX/fireball.png
Binary files differ
diff --git a/GFX/sprites.bms b/GFX/sprites.bms
index 8e5ba6f..b4ce2c9 100644
--- a/GFX/sprites.bms
+++ b/GFX/sprites.bms
Binary files differ
diff --git a/gametypes.bmx b/gametypes.bmx
index caf9a24..f5d3bf9 100644
--- a/gametypes.bmx
+++ b/gametypes.bmx
@@ -33,7 +33,7 @@ Const SHIP_MIN_SPEED:Double=1
Const MIN_TURN:Double=1
Const MAX_TURN:Double=5.0
Const MIN_SPEED:Double=1
-Const MAX_SPEED:Double=1.99
+Const MAX_SPEED:Double=2.2
Type GameState
Global score:Int=0
@@ -49,6 +49,7 @@ Type GameState
Global shield:Int=5*HERTZ
Global game_over:Int=False
Global hit:Int=False
+ Global pause:Int=False
Function Reset()
score=0
@@ -60,6 +61,7 @@ Type GameState
SetLevel(1)
ShieldShip()
game_over=False
+ pause=False
End Function
Function ShieldShip()
@@ -107,7 +109,8 @@ Type GameState
speed=Max(SHIP_MIN_SPEED,speed-SHIP_SPEED/2)
End If
- If KeyDown(GameConfig.kpause)
+ If KeyHit(GameConfig.kpause)
+ pause=True
End If
If KeyHit(KEY_ESCAPE)
@@ -247,34 +250,44 @@ Type Missile
Field onscreen:Int
Field turn:Double
Field speed:Double
+ Field accurate:Int
Method New()
Select Rand(1,4)
Case 1
- x=Rand(0,800)
+ x=Rand(20,780)
y=Rand(-100,0)
ang=180
Case 2
- x=Rand(0,800)
+ x=Rand(20,780)
y=Rand(600,700)
ang=0
Case 3
- y=Rand(0,600)
+ y=Rand(20,580)
x=Rand(-100,0)
ang=90
Case 4
- y=Rand(0,600)
+ y=Rand(20,580)
x=Rand(800,900)
ang=270
End Select
speed=Rnd(Max(MIN_SPEED,GameState.missile_speed-0.1),GameState.missile_speed)
turn=Rnd(Max(MIN_TURN,GameState.missile_turn-0.1),GameState.missile_turn)
onscreen=False
+ If Rand(100)>50
+ accurate=True
+ EndIf
End Method
- Method Update()
+ Method Update(tx:Double,ty:Double)
If onscreen
- Local a:Double=ATan2(GameState.x-x,y-GameState.y)
+ Local a:Double
+
+ If accurate
+ a=ATan2(tx-x,y-ty)
+ Else
+ a=ATan2(GameState.x-x,y-GameState.y)
+ EndIf
If a<0 Then a:+360
@@ -348,8 +361,10 @@ Type MissileSet
SetColor(255,255,255)
+ Local x:Double=(GameState.x+Sin(GameState.ang)*GameState.speed) Mod 800
+ Local y:Double=(GameState.y-Cos(GameState.ang)*GameState.speed) Mod 600
For Local m:Missile=EachIn plist
- m.Update()
+ m.Update(x,y)
Next
SetRotation(0)
diff --git a/global.bmx b/global.bmx
index dedad10..b120af7 100644
--- a/global.bmx
+++ b/global.bmx
@@ -38,6 +38,7 @@ Incbin "GFX/exhaust.png"
Incbin "GFX/flame.png"
Incbin "GFX/star.png"
Incbin "GFX/asteroid.png"
+Incbin "GFX/fireball.png"
Const HERTZ:Int=70
@@ -56,7 +57,7 @@ Type GFX
Global flame:TImage
Global star:TImage
Global asteroid:TImage
- Global explosion:TImage
+ Global fireball:TImage
Function SafeLoadImage:TImage(p:String, mode:Int)
Local i:TImage=LoadImage(p,mode)
@@ -92,6 +93,9 @@ Type GFX
asteroid=SafeLoadImage("incbin::GFX/asteroid.png",FILTEREDIMAGE)
MidHandleImage(asteroid)
+
+ fireball=SafeLoadImage("incbin::GFX/fireball.png",FILTEREDIMAGE)
+ SetImageHandle(fireball,7,7)
End Function
End Type
@@ -181,12 +185,20 @@ Type Scroller
Global msgx:Int
Function Init()
+ Rem
msg=" "
- msg:+"DURING A TEST-FLIGHT OF THE STAR-FIGHTER XY-9 YOU ARE AMBUSHED IN THE ASTEROID FIELD OUTSIDE OF MARS... "
+ msg:+"DURING A TEST-FLIGHT OF THE STAR-FIGHTER OGL-X YOU ARE AMBUSHED IN THE ASTEROID FIELD OUTSIDE OF MARS... "
msg:+"THE EVIL EMPIRE CANNOT BE ALLOWED TO DESTROY THE PROTOTYPE SO YOU MUST PILOT THE WEAPONLESS CRAFT, "
msg:+"AVOIDING THE DEADLY MISSILES UNTIL HELP ARRIVES... "
msg:+"SHOW HEART YOUNG PILOT, STAR-FLEET IS DEPENDING UPON YOU!"
-
+ EndRem
+
+ msg=" "
+ msg:+"IT IS A TIME OF WAR. IN A LAST DITCH ATTEMPT TO WIN A LOSING WAR THAT HAS RAGED THROUGH THE GALAXY AGAINST THE EVIL EMPIRE "
+ msg:+"A NEW SHIP, THE DX-9, HAS BEEN DEVELOPED. ON A ROUTINE TEST FLIGHT THE SHIP HAS BEEN AMBUSHED IN AN ASTEROID FIELD. "
+ msg:+"WEAPONLESS, YOU MUST PILOT THE DX-9 AND AVOID THE EMPIRE'S MISSILE SALVOS AMONGST THE ASTEROIDS... HELP WILL ARRIVE EVENTUALLY, "
+ msg:+"BUT UNTIL THEN YOU ARE OUR LAST HOPE. IF THE DX-9 IS LOST THEN SO IS THE EARTH. EARTH IS DEPENDING ON YOU!!!"
+
msgx=0
msgp=0
End Function
@@ -202,6 +214,49 @@ Type Scroller
End Function
End Type
+Type VText
+ Field t:String
+ Field y:Int
+
+ Function Create:VText(t:String, y:Int)
+ Local o:VText=New VText
+ o.t=t
+ o.y=y
+ Return o
+ End Function
+End Type
+
+Type VerticalScroller
+ Global msg:TList
+ Global maxy:Int
+
+ Method New()
+ msg=CreateList()
+ maxy=0
+ End Method
+
+ Method Add(s:String)
+ SetScale(2,2)
+ msg.AddLast(VText.Create(s,maxy+800))
+ maxy:+GFX.font.TextHeight(s)
+ SetScale(1,1)
+ End Method
+
+ Method Draw()
+ SetScale(2,2)
+ For Local o:VText=EachIn msg
+ o.y:-1
+ If o.y<-GFX.font.TextHeight(o.t)
+ o.y:+maxy
+ EndIf
+ If o.y<799
+ GFX.font.Centre(o.t,o.y)
+ EndIf
+ Next
+ SetScale(1,1)
+ End Method
+End Type
+
Type Thanks
Global item:String[]
Global i:Int
@@ -259,6 +314,18 @@ Type TFadeScreen
Return Create(1,-0.05)
End Function
+ Function DoFadeIn()
+ Local fade:TFadeScreen=TFadeScreen.FadeIn()
+ Local pm:TPixmap=GrabPixmap(0,0,GraphicsWidth(),GraphicsHeight())
+
+ While fade.Fade()
+ Cls
+ DrawPixmap(pm,0,0)
+ fade.Draw()
+ Flip
+ Wend
+ End Function
+
Function DoFadeOut()
Local fade:TFadeScreen=TFadeScreen.FadeOut()
Local pm:TPixmap=GrabPixmap(0,0,GraphicsWidth(),GraphicsHeight())
diff --git a/missile_lock.bmx b/missile_lock.bmx
index ebd5017..b2b7bea 100644
--- a/missile_lock.bmx
+++ b/missile_lock.bmx
@@ -84,6 +84,7 @@ Menu()
While Not quit
GameState.Reset()
+ 'GameState.SetLevel(10)
MissileSet.StartLevel()
AsteroidSet.StartLevel()
@@ -97,7 +98,6 @@ While Not quit
Particles.Draw()
Trail.Draw()
- GameState.Display()
GameState.Control()
GameState.Move()
@@ -131,7 +131,18 @@ While Not quit
EndIf
EndIf
+ If GameState.pause
+ GFX.font.Centre("PAUSED!",300,255,255,0)
+ EndIf
+
+ GameState.Display()
Flip(1)
+
+ If GameState.pause
+ GameState.pause=False
+ While Not KeyHit(GameConfig.kpause) And Not KeyHit(KEY_ESCAPE)
+ Wend
+ EndIf
Wend
If Not GameState.game_over
@@ -155,7 +166,6 @@ While Not quit
Particles.Draw()
Trail.Draw()
- GameState.Display()
GameState.Control()
GameState.Move()
@@ -187,7 +197,19 @@ While Not quit
GFX.font.Centre("GET READY!",300)
EndIf
+ If GameState.pause
+ GFX.font.Centre("PAUSED!",300,255,255,0)
+ EndIf
+
+ GameState.Display()
Flip(1)
+
+ If GameState.pause
+ GameState.pause=False
+ While Not KeyHit(GameConfig.kpause) And Not KeyHit(KEY_ESCAPE)
+ Wend
+ EndIf
+
timer:-1
Wend
@@ -262,14 +284,15 @@ Function Menu()
While Not done
Cls
-
- If Rand(100)>30
- Particles.AddScaledImage(GFX.exhaust,Rand(0,800),Rand(0,600),0.3)
+
+ If Rand(100)>80
+ Local x:Int=Rand(0,800)
+ Local y:Int=Rand(0,600)
+ Particles.AddScaledImage(GFX.fireball,x,y,0.1)
End If
Backdrop.Draw()
Particles.Draw()
- GameState.Display()
Scroller.Draw(560)
SetColor(255,255,255)
@@ -366,11 +389,10 @@ Function Menu()
EndIf
EndIf
+ GameState.Display()
Flip(1)
Wend
Particles.Clear()
TFadeScreen.DoFadeOut()
End Function
-
-
diff --git a/particle.bmx b/particle.bmx
index e511ace..da31401 100644
--- a/particle.bmx
+++ b/particle.bmx
@@ -114,7 +114,7 @@ Type Particles
End Function
Function AddBigExplosion(x:Double, y:Double)
- plist.AddLast(TParticle.ScaleImage(GFX.exhaust,x,y,0,0,0.3,255,0,0))
+ plist.AddLast(TParticle.ScaleImage(GFX.fireball,x,y,0,0,0.1,255,255,255))
For Local f:Int=0 To 50
plist.AddLast(TParticle.Image(GFX.star,x,y,Rnd(-2,2),Rnd(-2,2),Rand(100,255),Rand(100,255),Rand(100,255)))
Next