From 1c900457e45e70e12a04b2c5b909e0bd9a9d8a3e Mon Sep 17 00:00:00 2001 From: Ian C Date: Tue, 2 May 2006 22:50:22 +0000 Subject: Updates --- gametypes.bmx | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'gametypes.bmx') 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) -- cgit v1.2.3