diff options
author | Ian C <ianc@noddybox.co.uk> | 2006-04-25 23:45:01 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2006-04-25 23:45:01 +0000 |
commit | c93d5990b230175597557978d0bc2c094bee3bdb (patch) | |
tree | 31aedf971660b7db1e8338531e577d140a425766 /global.bmx | |
parent | 0c54a57c59fdce1ffc0055f57983ad090a3e18e6 (diff) |
Initial working version
Diffstat (limited to 'global.bmx')
-rw-r--r-- | global.bmx | 85 |
1 files changed, 56 insertions, 29 deletions
@@ -37,24 +37,13 @@ Incbin "GFX/missile.png" Incbin "GFX/exhaust.png" Incbin "GFX/flame.png" Incbin "GFX/star.png" +Incbin "GFX/asteroid.png" Const HERTZ:Int=70 -Type Lookup - Global si:Double[] - Global co:Double[] - - Function Init() - si=New Double[360] - co=New Double[360] - - For Local a:Double=0 To 359 - si[a]=Sin(a) - co[a]=Cos(a) - Next - End Function -End Type - +Const MISSILE_LAYER:Int=1 +Const ASTEROID_LAYER:Int=2 +Const ALL_LAYERS:Int=3 Type GFX Global font:TBitmapFont @@ -66,7 +55,9 @@ Type GFX Global exhaust:TImage Global flame:TImage Global star:TImage - + Global asteroid:TImage + Global explosion:TImage + Function SafeLoadImage:TImage(p:String, mode:Int) Local i:TImage=LoadImage(p,mode) Assert i,"Failed to load " + p @@ -98,6 +89,9 @@ Type GFX star=SafeLoadImage("incbin::GFX/star.png",0) SetImageHandle(star,1,1) + + asteroid=SafeLoadImage("incbin::GFX/asteroid.png",FILTEREDIMAGE) + MidHandleImage(asteroid) End Function End Type @@ -105,7 +99,7 @@ Type GameConfig Global kleft:Int Global kright:Int Global kpause:Int - Global kfire:Int + Global kthrust:Int Global hiscore:Int Function Load() @@ -114,7 +108,7 @@ Type GameConfig If s=Null kleft=KEY_LEFT kright=KEY_RIGHT - kfire=KEY_SPACE + kthrust=KEY_SPACE kpause=KEY_P hiscore=0 Return @@ -124,7 +118,7 @@ Type GameConfig kleft=s.ReadInt() kright=s.ReadInt() - kfire=s.ReadInt() + kthrust=s.ReadInt() kpause=s.ReadInt() hiscore=s.ReadInt() @@ -142,7 +136,7 @@ Type GameConfig s.WriteInt(kleft) s.WriteInt(kright) - s.WriteInt(kfire) + s.WriteInt(kthrust) s.WriteInt(kpause) s.WriteInt(hiscore) @@ -185,25 +179,20 @@ Type Scroller Global msg:String Global msgp:Int Global msgx:Int - Global msgy:Int Function Init() msg=" " - msg:+"DURING A TEST-FLIGHT OF THE STAR-FIGHTER OX-9 YOU ARE AMBUSHED IN THE ASTEROID FIELD... " - msg:+"THE EVIL EMPIRE CANNOT BE ALLOWED TO DESTROY THE PROTOTYPE SO YOU MUST PILOT THE WEAPONLESS OX-9 " + msg:+"DURING A TEST-FLIGHT OF THE STAR-FIGHTER XY-9 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!" - 'msg:+"TAKE THE LAST REMAINING STAR-FIGHTER AND USE SKILL AND JUDGEMENT TO AVOID THE DEADLY MISSILES THE EVIL ALIENS ARE FIRING AT YOU WHILE " - 'msg:+"DESTROYING THEIR ADVANCING FLEET... " - 'msg:+"SHOW HEART YOUNG PILOT, THE EARTH IS DEPENDING UPON YOU!" msgx=0 msgp=0 - msgy=560 End Function - Function Draw() - GFX.font.Draw(msg[..70],msgx,msgy) + Function Draw(y:Int) + GFX.font.Draw(msg[..70],msgx,y) msgx:-2 If msgx<-GFX.font.TextWidth(msg[0..1]) @@ -213,6 +202,44 @@ Type Scroller End Function End Type +Type Thanks + Global item:String[] + Global i:Int + Global wait:Int + Global a:Double + Global ai:Double + + Function Init() + item=["HTTP://WWW.SLAYRADIO.ORG/", .. + "HTTP://WWW.BLITZBASIC.COM/"] + i=0 + a=0 + ai=0.05 + End Function + + Function Draw(y:Int) + SetAlpha(a) + GFX.font.Centre(item[i],y) + SetAlpha(1) + + If wait + wait:-1 + Else + a:+ai + + If a>1 + wait=HERTZ*5 + ai=-0.05 + a=1 + ElseIf a<0 + i=(i+1) Mod item.length + ai=0.05 + a=0 + EndIf + EndIf + End Function +End Type + Type TFadeScreen Field a:Double Field ai:Double |