diff options
Diffstat (limited to 'main.bmx')
-rw-r--r-- | main.bmx | 124 |
1 files changed, 114 insertions, 10 deletions
@@ -9,6 +9,7 @@ Strict Import noddybox.vector Import noddybox.bitmapfont Import noddybox.simplegui +Import noddybox.keysyms Import "types.bmx" Import "level.bmx" @@ -21,11 +22,12 @@ Import "menu.bmx" Incbin "GFX/font.bmf" Incbin "GFX/small.bmf" Incbin "GFX/STAR.png" -Incbin "GFX/MASS.png" +Incbin "GFX/SHIP.png" Incbin "GFX/POINT.png" Incbin "GFX/PARTICLE.png" Incbin "GFX/POINTER.png" Incbin "GFX/COLLECTOR.png" +Incbin "GFX/SHOCK.png" Incbin "GFX/play_button.png" Incbin "GFX/edit_button.png" Incbin "GFX/load_button.png" @@ -34,12 +36,21 @@ Incbin "GFX/quit_button.png" Incbin "GFX/left_button.png" Incbin "GFX/right_button.png" Incbin "GFX/scores_button.png" +Incbin "GFX/keys_button.png" ' Initialise ' SeedRnd(MilliSecs()) -SetGraphicsDriver GLMax2DDriver() + +?Win32 +If Switch("--directx") + SetGraphicsDriver D3D7Max2DDriver() +Else + SetGraphicsDriver GLMax2DDriver() +EndIf +? + Graphics 800,600,32,60 HideMouse @@ -51,11 +62,12 @@ SetAlpha(1.0) GameGFX.font=TBitmapFont.Load("incbin::GFX/font.bmf",0) GameGFX.smallfont=TBitmapFont.Load("incbin::GFX/small.bmf",0) GameGFX.star=LoadAnimImage("incbin::GFX/STAR.png",8,8,0,2) -GameGFX.mass=LoadAnimImage("incbin::GFX/MASS.png",8,8,0,2) +GameGFX.ship=LoadImage("incbin::GFX/SHIP.png",FILTEREDIMAGE) GameGFX.collector=LoadAnimImage("incbin::GFX/COLLECTOR.png",8,8,0,2) GameGFX.point=LoadImage("incbin::GFX/POINT.png",FILTEREDIMAGE) GameGFX.particle=LoadImage("incbin::GFX/PARTICLE.png",0) GameGFX.pointer=LoadImage("incbin::GFX/POINTER.png",0) +GameGFX.shock=LoadImage("incbin::GFX/SHOCK.png",0) GameGFX.play_button=LoadImage("incbin::GFX/play_button.png",0) GameGFX.edit_button=LoadImage("incbin::GFX/edit_button.png",0) GameGFX.load_button=LoadImage("incbin::GFX/load_button.png",0) @@ -64,26 +76,38 @@ GameGFX.quit_button=LoadImage("incbin::GFX/quit_button.png",0) GameGFX.left_button=LoadImage("incbin::GFX/left_button.png",0) GameGFX.right_button=LoadImage("incbin::GFX/right_button.png",0) GameGFX.scores_button=LoadImage("incbin::GFX/scores_button.png",0) +GameGFX.keys_button=LoadImage("incbin::GFX/keys_button.png",0) SetImageHandle(GameGFX.star,3,3) -SetImageHandle(GameGFX.mass,3,3) +SetImageHandle(GameGFX.ship,7,7) SetImageHandle(GameGFX.collector,3,3) SetImageHandle(GameGFX.point,3,3) SetImageHandle(GameGFX.particle,3,3) SetImageHandle(GameGFX.pointer,0,0) +SetImageHandle(GameGFX.shock,3,3) TPoint.img=GameGFX.point TParticle.img=GameGFX.particle TGUIFont.font=GameGFX.font +Lookup.Init() TParticleMachine.Init() +GameConfig.Load() Global quit:Int=False Global levelfile:String="Default.ppinch" Global levelset:TLevelSet=Null Global selected_level:Int=0 +' Check designer mode +' +If Switch("--design") + LevelDesigner() + EndGraphics + End +EndIf + ' Initialisation ' Try @@ -117,7 +141,7 @@ Function Error(s:String, fatal:Int=False) Local t:Int=0 FlushKeys() - SetScale(3,3) + SetScale(2,2) While Not KeyHit(KEY_ESCAPE) Cls @@ -150,6 +174,20 @@ Function Error(s:String, fatal:Int=False) End Function ' =================================== +' Argument Routines +' =================================== +' +Function Switch:Int(s:String) + For Local a:String=EachIn AppArgs + If a=s + Return True + EndIf + Next + + Return False +End Function + +' =================================== ' Menu Routines ' =================================== ' @@ -162,6 +200,7 @@ Function Menu() Const MENU_LEFT:Int=6 Const MENU_RIGHT:Int=7 Const MENU_SCORES:Int=8 + Const MENU_KEYS:Int=9 Local done:Int=False Local menu:TMenu=TMenu.Create() @@ -170,12 +209,16 @@ Function Menu() Local x1:Int=(GraphicsWidth()/2-ImageWidth(GameGFX.play_button))/2 Local x2:Int=x1+GraphicsWidth()/2 + Local defkey:Int=0 + menu.Add(x1,100,GameGFX.play_button,MENU_PLAY) menu.Add(x2,100,GameGFX.scores_button,MENU_SCORES) menu.Add(x1,200,GameGFX.load_button,MENU_LOAD) menu.Add(x2,200,GameGFX.edit_button,MENU_EDIT) menu.Add(x1,300,GameGFX.toy_button,MENU_TOY) - menu.Add(x2,300,GameGFX.quit_button,MENU_QUIT) + menu.Add(x2,300,GameGFX.keys_button,MENU_KEYS) + menu.Add(-1,400,GameGFX.quit_button,MENU_QUIT) + menu.Add(64,530,GameGFX.left_button,MENU_LEFT) menu.Add(GraphicsWidth()-96,530,GameGFX.right_button,MENU_RIGHT) @@ -187,7 +230,62 @@ Function Menu() Cls - sel=menu.Render() + If defkey>0 + + SetScale(2,2) + + If defkey=6 + GameGFX.font.Centre("PRESS A KEY TO GO BACK TO THE MENU",50) + Else + GameGFX.font.Centre("DEFINE KEYS",50) + EndIf + + GameGFX.font.DrawColoured("Left",250,100,255,255*(defkey=1),0) + GameGFX.font.DrawColoured("Right",250,120,255,255*(defkey=2),0) + GameGFX.font.DrawColoured("Thrust",250,140,255,255*(defkey=3),0) + GameGFX.font.DrawColoured("Reverse",250,160,255,255*(defkey=4),0) + GameGFX.font.DrawColoured("Gravity Wave",250,180,255,255*(defkey=5),0) + GameGFX.font.DrawColoured(KeySym(GameConfig.kleft),500,100,255,255*(defkey=1),0) + GameGFX.font.DrawColoured(KeySym(GameConfig.kright),500,120,255,255*(defkey=2),0) + GameGFX.font.DrawColoured(KeySym(GameConfig.kthrust),500,140,255,255*(defkey=3),0) + GameGFX.font.DrawColoured(KeySym(GameConfig.kreverse),500,160,255,255*(defkey=4),0) + GameGFX.font.DrawColoured(KeySym(GameConfig.kblast),500,180,255,255*(defkey=5),0) + + Local k:Int=0 + + For Local f:Int=1 To 255 + If KeyHit(f) + k=f + Continue + EndIf + Next + + If k<>0 + Select defkey + Case 1 + GameConfig.kleft=k + Case 2 + GameConfig.kright=k + Case 3 + GameConfig.kthrust=k + Case 4 + GameConfig.kreverse=k + Case 5 + GameConfig.kblast=k + End Select + + defkey:+1 + + If defkey=7 + GameConfig.Save() + defkey=0 + EndIf + EndIf + + SetScale(1,1) + EndIf + + sel=menu.Render(defkey>0) Select sel Case MENU_PLAY @@ -203,6 +301,9 @@ Function Menu() Case MENU_TOY done=True FlushKeys() + Case MENU_KEYS + FlushKeys() + defkey=1 Case MENU_QUIT done=True quit=True @@ -215,11 +316,14 @@ Function Menu() Case MENU_RIGHT selected_level=(selected_level+1) Mod levelset.level.Count() End Select - + SetScale(2,2) GameGFX.font.CentreColoured("PARTICLE PINCH",0,255,255,0) - GameGFX.font.CentreColoured("Start Level",530,0,255,255) - GameGFX.font.Centre(levelset.Get(selected_level).name,545) + + If defkey=0 + GameGFX.font.CentreColoured("Start Level",528,0,255,255) + GameGFX.font.Centre(levelset.Get(selected_level).name,547) + EndIf SetScale(1,1) GameGFX.font.CentreColoured("Copyright (c) 2005 Ian Cowburn",20,255,0,0) |