From e9c53b3a4f3fd89176a34e8bd4aa527b51ca89ff Mon Sep 17 00:00:00 2001 From: Ian C Date: Sun, 11 Jun 2006 00:52:01 +0000 Subject: Added twinkling stars and starting level options --- GFX/sprites.bms | Bin 7307 -> 8906 bytes GFX/twinkle.png | Bin 0 -> 221 bytes gametypes.bmx | 23 +++++++++++++++++++++-- global.bmx | 9 +++++++++ missile_lock.bmx | 39 +++++++++++++++++++++++++++++++++++++-- 5 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 GFX/twinkle.png diff --git a/GFX/sprites.bms b/GFX/sprites.bms index 6af2e13..786efca 100644 Binary files a/GFX/sprites.bms and b/GFX/sprites.bms differ diff --git a/GFX/twinkle.png b/GFX/twinkle.png new file mode 100644 index 0000000..e265e89 Binary files /dev/null and b/GFX/twinkle.png differ diff --git a/gametypes.bmx b/gametypes.bmx index 7956568..1e5fb54 100644 --- a/gametypes.bmx +++ b/gametypes.bmx @@ -169,10 +169,12 @@ Type BackdropStar Field r:Int Field g:Int Field b:Int + Field twinkle:Int + Field frame:Int Method New() x=Rand(0,800) - y=Rand(0,600) + y=Rand(0,598) r=Rand(128,255) g=Rand(128,255) b=Rand(128,255) @@ -183,19 +185,36 @@ End Type Type Backdrop Const NUM:Int=100 Global s:BackdropStar[] + Global frame:Int Function Init() s=New BackdropStar[NUM] For Local f:Int=0 Until NUM s[f]=New BackdropStar + s[f].frame=f Mod 6 + s[f].twinkle=Rand(100)>70 Next + + frame=0 End Function Function Draw() + frame=(frame+1) Mod 6 For Local f:Int=0 Until NUM SetColor(s[f].r,s[f].g,s[f].b) - DrawImage(GFX.star,s[f].x,s[f].y) + If s[f].twinkle + DrawImage(GFX.twinkle,s[f].x,s[f].y,s[f].frame) + If Not frame + s[f].frame=(s[f].frame+1) Mod 6 + s[f].x=(s[f].x+2) Mod 800 + EndIf + Else + DrawImage(GFX.star,s[f].x,s[f].y) + If Not frame + s[f].x=(s[f].x+1) Mod 800 + EndIf + EndIf Next End Function End Type diff --git a/global.bmx b/global.bmx index e953197..dbcd52e 100644 --- a/global.bmx +++ b/global.bmx @@ -37,6 +37,7 @@ Incbin "GFX/missile.png" Incbin "GFX/exhaust.png" Incbin "GFX/flame.png" Incbin "GFX/star.png" +Incbin "GFX/twinkle.png" Incbin "GFX/asteroid.png" Incbin "GFX/fireball.png" @@ -56,6 +57,7 @@ Type GFX Global exhaust:TImage Global flame:TImage Global star:TImage + Global twinkle:TImage Global asteroid:TImage Global fireball:TImage @@ -91,6 +93,9 @@ Type GFX star=SafeLoadImage("incbin::GFX/star.png",0) SetImageHandle(star,1,1) + twinkle=SafeLoadAnimImage("incbin::GFX/twinkle.png",8,8,0,6,0) + SetImageHandle(star,2,2) + asteroid=SafeLoadImage("incbin::GFX/asteroid.png",FILTEREDIMAGE) MidHandleImage(asteroid) @@ -105,6 +110,7 @@ Type GameConfig Global kpause:Int Global kthrust:Int Global hiscore:Int + Global maxlevel:Int Global accepted:Int Function Load() @@ -116,6 +122,7 @@ Type GameConfig kthrust=KEY_SPACE kpause=KEY_P hiscore=0 + maxlevel=1 accepted=False Return EndIf @@ -127,6 +134,7 @@ Type GameConfig kthrust=s.ReadInt() kpause=s.ReadInt() hiscore=s.ReadInt() + maxlevel=s.ReadInt() accepted=s.ReadInt() s.Close() @@ -146,6 +154,7 @@ Type GameConfig s.WriteInt(kthrust) s.WriteInt(kpause) s.WriteInt(hiscore) + s.WriteInt(maxlevel) s.WriteInt(accepted) s.Close() diff --git a/missile_lock.bmx b/missile_lock.bmx index 609f36b..a7685fb 100644 --- a/missile_lock.bmx +++ b/missile_lock.bmx @@ -90,6 +90,7 @@ MissileSet.Init() AsteroidSet.Init() Global quit:Int=False +Global start_level:Int=1 ' =================================== @@ -101,8 +102,10 @@ Menu() FlushKeys() While Not quit + Local start_bonus:Int=1000*(start_level-1) + GameState.Reset() - 'GameState.SetLevel(25) + GameState.SetLevel(start_level) MissileSet.StartLevel() AsteroidSet.StartLevel() @@ -191,6 +194,10 @@ While Not quit GameState.AddScore(500*GameState.level) EndIf + If start_bonus + GameState.AddScore(start_bonus) + EndIf + If GameState.bonus_timer bonus:+GameState.bonus_timer bt=GameState.bonus_timer @@ -237,6 +244,11 @@ While Not quit y:+20 EndIf + If start_bonus + GFX.font.Centre("STARTING LEVEL BONUS " + start_bonus + "!!!",y,255,255,0) + y:+20 + EndIf + If GameState.gonads GFX.font.Centre("SECRET GONADS OF STEEL BONUS " + (9999+(GameState.level-1)*10000) + "!!!",y,255,255,0) y:+20 @@ -267,6 +279,8 @@ While Not quit timer:-1 Wend + start_bonus=0 + GameState.AddScore(bonus-added) GameState.LevelUp() @@ -275,6 +289,7 @@ While Not quit EndIf Wend + GameConfig.maxlevel=GameState.level GameConfig.Save() MissileSet.Nuke() @@ -339,11 +354,13 @@ Function Menu() While Not done Cls - If Rand(100)>80 + Rem + If Rand(100)>90 Local x:Int=Rand(0,800) Local y:Int=Rand(0,600) Particles.AddScaledImage(GFX.fireball,x,y,0.1) End If + End Rem Backdrop.Draw() Particles.Draw() @@ -423,6 +440,20 @@ Function Menu() FlushKeys() EndIf + If GameConfig.maxlevel>1 + If KeyHit(KEY_LEFT) Or KeyHit(KEY_DOWN) + start_level=start_level-1 + If start_level<1 + start_level=GameConfig.maxlevel + EndIf + ElseIf KeyHit(KEY_RIGHT) Or KeyHit(KEY_UP) + start_level=start_level+1 + If start_level>GameConfig.maxlevel + start_level=1 + EndIf + End If + EndIf + GFX.font.Centre("COPYRIGHT (C) NODDYBOX 2006",200) GFX.font.Centre("HTTP://WWW.NODDYBOX.CO.UK/",226) @@ -431,6 +462,10 @@ Function Menu() GFX.font.Centre("PRESS " + KeySym(GameConfig.kthrust).ToUpper() + " TO PLAY",400) + If GameConfig.maxlevel>1 + GFX.font.Centre("CURSORS TO SELECT STARTING LEVEL: "+start_level,460) + EndIf + GFX.font.Centre("PRESS R TO REDEFINE KEYS",480) GFX.font.Centre("PRESS ESCAPE TO QUIT",500) EndIf -- cgit v1.2.3