From cf0e1b5f3422dc1adc60b1684591ab0962c441bb Mon Sep 17 00:00:00 2001 From: Ian C Date: Mon, 5 Dec 2005 00:59:34 +0000 Subject: Updates and added help page --- GFX/bdropstar.png | Bin 0 -> 234 bytes GFX/gameover.png | Bin 0 -> 20894 bytes GFX/gfx.bms | Bin 0 -> 1609 bytes GFX/rules_button.png | Bin 0 -> 7636 bytes HELP/bomb.png | Bin 0 -> 1495 bytes HELP/help.txt | 64 ++++++++++++++++ HELP/loop1.png | Bin 0 -> 9091 bytes HELP/piece.png | Bin 0 -> 3142 bytes HELP/pit.png | Bin 0 -> 869 bytes HELP/twister.png | Bin 0 -> 1833 bytes HELP/wire1.png | Bin 0 -> 4061 bytes HELP/wire2.png | Bin 0 -> 3884 bytes HELP/wire3.png | Bin 0 -> 4094 bytes game.bmx | 33 +++++++- gametypes.bmx | 9 ++- hardwire.bmx | 54 +++++++++++-- help.bmx | 209 +++++++++++++++++++++++++++++++++++++++++++++++++++ particle.bmx | 112 +++++++++++++++++++++++++++ types.bmx | 172 +++++++++++++++++++++++++++++++++++++++--- 19 files changed, 632 insertions(+), 21 deletions(-) create mode 100644 GFX/bdropstar.png create mode 100644 GFX/gameover.png create mode 100644 GFX/gfx.bms create mode 100644 GFX/rules_button.png create mode 100644 HELP/bomb.png create mode 100644 HELP/help.txt create mode 100644 HELP/loop1.png create mode 100644 HELP/piece.png create mode 100644 HELP/pit.png create mode 100644 HELP/twister.png create mode 100644 HELP/wire1.png create mode 100644 HELP/wire2.png create mode 100644 HELP/wire3.png create mode 100644 help.bmx diff --git a/GFX/bdropstar.png b/GFX/bdropstar.png new file mode 100644 index 0000000..52437a4 Binary files /dev/null and b/GFX/bdropstar.png differ diff --git a/GFX/gameover.png b/GFX/gameover.png new file mode 100644 index 0000000..d790c26 Binary files /dev/null and b/GFX/gameover.png differ diff --git a/GFX/gfx.bms b/GFX/gfx.bms new file mode 100644 index 0000000..12ce309 Binary files /dev/null and b/GFX/gfx.bms differ diff --git a/GFX/rules_button.png b/GFX/rules_button.png new file mode 100644 index 0000000..7bdbbf4 Binary files /dev/null and b/GFX/rules_button.png differ diff --git a/HELP/bomb.png b/HELP/bomb.png new file mode 100644 index 0000000..0bb3eed Binary files /dev/null and b/HELP/bomb.png differ diff --git a/HELP/help.txt b/HELP/help.txt new file mode 100644 index 0000000..ef89506 --- /dev/null +++ b/HELP/help.txt @@ -0,0 +1,64 @@ + +@THE RULES + +You start with an empty pit that has electrodes +down the sides and at the bottom. + +#incbin::HELP/pit.png + +You must connect these using geometric +shapes that fall from the sky which have +wires embedded in the blocks... + +#incbin::HELP/piece.png + +I'm sure you'll (cough) recognise the shapes. + +Once a piece has landed in the pit if a +connection can be made between electrodes, +or a loop of wires can be made, then these +are removed and you score lovely points... + +#incbin::HELP/wire1.png + +#incbin::HELP/loop1.png + +If a connection cannot be made, as in this one: + +#incbin::HELP/wire2.png + +Then the peices are unglued and any hanging bits +drop down into the pit to make other possible +loops... + +#incbin::HELP/wire3.png + +If a piece lands with anything sticking out of the +top of the pit, it's GAME OVER. + + +@SPECIAL PIECES + +Once in a while a special piece may drop down... + + +!SMART BOMB + +#incbin::HELP/bomb.png + +This special will destroy all blocks that are the +same as the one it lands on. Landing on nothing +is probably not a good idea... + + +!TWISTER + +#incbin::HELP/twister.png + +The twister will rotate all the pieces in the pit +four times, scoring any loops and wires that +are made from doing this. + + +* * * * * * * * * * * * * + diff --git a/HELP/loop1.png b/HELP/loop1.png new file mode 100644 index 0000000..26a2804 Binary files /dev/null and b/HELP/loop1.png differ diff --git a/HELP/piece.png b/HELP/piece.png new file mode 100644 index 0000000..c49339e Binary files /dev/null and b/HELP/piece.png differ diff --git a/HELP/pit.png b/HELP/pit.png new file mode 100644 index 0000000..1464996 Binary files /dev/null and b/HELP/pit.png differ diff --git a/HELP/twister.png b/HELP/twister.png new file mode 100644 index 0000000..61b3e40 Binary files /dev/null and b/HELP/twister.png differ diff --git a/HELP/wire1.png b/HELP/wire1.png new file mode 100644 index 0000000..d4116c2 Binary files /dev/null and b/HELP/wire1.png differ diff --git a/HELP/wire2.png b/HELP/wire2.png new file mode 100644 index 0000000..ad44b14 Binary files /dev/null and b/HELP/wire2.png differ diff --git a/HELP/wire3.png b/HELP/wire3.png new file mode 100644 index 0000000..5e8f709 Binary files /dev/null and b/HELP/wire3.png differ diff --git a/game.bmx b/game.bmx index 16fb3e7..64bf2d5 100644 --- a/game.bmx +++ b/game.bmx @@ -22,6 +22,8 @@ Type TGame Field block:TPiece Field nextblock:TPiece Field drop:Int + Field fade:TFadeScreen + Field bdrop:TGameBackdrop Method New() score=0 @@ -29,6 +31,7 @@ Type TGame level=1 Particles.Clear() TextParticles.Clear() + ExplosionParticles.Clear() alpha=0.0 alphainc=0.01 count=0 @@ -36,6 +39,8 @@ Type TGame nextblock=TPiece.Create(False) drop=False CreateNext(False) + fade=TFadeScreen.FadeIn() + bdrop=New TGameBackdrop End Method Method SetInitLevel(l:Int) @@ -86,12 +91,16 @@ Type TGame For Local f:Int=0 Until a.length SetAlpha(al) SetRotation(a[f]) - SetScale(al,al) + SetScale(al*2,al*2) DrawImage(i,GraphicsWidth()/2,GraphicsHeight()/2) If ac[f]>0 ac[f]:-1 Else - a[f]:+1 + If f Mod 2 + a[f]:+1 + Else + a[f]:-1 + EndIf EndIf al:+0.1 Next @@ -115,12 +124,20 @@ Type TGame Cls + bdrop.Draw() + GameGFX.large.Draw("SCORE",0,0,255,255,0) GameGFX.large.Draw(score,0,20) GameGFX.large.Draw("LEVEL",0,100,255,255,0) GameGFX.large.Draw(level,0,120) + GameGFX.large.Draw("HISCORE",0,200,255,255,0) + If score>GameConfig.hiscore + GameConfig.hiscore=score + EndIf + GameGFX.large.Draw(GameConfig.hiscore,0,220) + nextblock.Draw() block.Draw() @@ -148,7 +165,7 @@ Type TGame If Not gm.overflow score:+level*2 - CreateNext((total Mod 2)=0) ' 15 + CreateNext((total Mod 15)=0) ' 15 Else FlushKeys() EndIf @@ -217,6 +234,7 @@ Type TGame EndIf Particles.Draw() + ExplosionParticles.Draw() TextParticles.Draw() If KeyHit(GameConfig.kpause) And Not gm.overflow @@ -224,6 +242,15 @@ Type TGame EndIf Sound.Process() + + If fade + If fade.Fade() + fade.Draw() + Else + fade=Null + EndIf + EndIf + Flip Return playing diff --git a/gametypes.bmx b/gametypes.bmx index 63a642b..7c60b71 100644 --- a/gametypes.bmx +++ b/gametypes.bmx @@ -399,6 +399,8 @@ Type TPiece_SpecialBomb Extends TSpecial End Method Method DoSpecial:Int(gm:TGameMap) + Draw() + Local l:TWireList=New TWireList If y0) @@ -212,14 +231,21 @@ Function Menu() GameGFX.large.Draw("START LEVEL ",tx1,356) GameGFX.large.Draw(GameConfig.start_level,tx2,356,255,255,0) + + GameGFX.large.CentreOn("LAST SCORE",200,500) + GameGFX.large.CentreOn("HIGH SCORE",600,500) + GameGFX.large.CentreOn(last_score,200,520,255,255,0) + GameGFX.large.CentreOn(GameConfig.hiscore,600,520,255,255,0) EndIf Select sel Case MENU_PLAY done=True FlushKeys() - Case MENU_SCORES + Case MENU_RULES FlushKeys() + Local help:THelp=New THelp + help.Show() Case MENU_KEYS FlushKeys() defkey=1 @@ -245,6 +271,24 @@ Function Menu() SetColor(255,255,255) DrawImage(GameGFX.pointer,MouseX(),MouseY()) + If fade + If fade.Fade() + fade.Draw() + Else + fade=Null + EndIf + EndIf + + Flip + Wend + + fade:TFadeScreen=TFadeScreen.FadeOut() + Local pm:TPixmap=GrabPixmap(0,0,GraphicsWidth(),GraphicsHeight()) + + While fade.Fade() + Cls + DrawPixmap(pm,0,0) + fade.Draw() Flip Wend End Function \ No newline at end of file diff --git a/help.bmx b/help.bmx new file mode 100644 index 0000000..df2e80b --- /dev/null +++ b/help.bmx @@ -0,0 +1,209 @@ +' Hardwire +' +' Copyright 2005 Ian Cowburn +' +' $Id$ +' +Strict +Import "types.bmx" + +Import noddybox.bitmapfont +Import noddybox.gfxmenu + + +' Included binaries +' +Incbin "HELP/help.txt" +Incbin "HELP/pit.png" +Incbin "HELP/piece.png" +Incbin "HELP/wire1.png" +Incbin "HELP/wire2.png" +Incbin "HELP/wire3.png" +Incbin "HELP/loop1.png" +Incbin "HELP/bomb.png" +Incbin "HELP/twister.png" + +Type THelp + Const TOP:Int=50 + Const BOTTOM:Int=550 + Field list:TList + Field pos:Int + Field item:TLink + Field del:Int + + Method New() + Local str:TStream=ReadStream("incbin::HELP/help.txt") + + Assert str,"Unable to open help file" + + list=CreateList() + + While Not str.Eof() + Local line:String=str.ReadLine() + + If line.length And line[0]=Asc("#") + list.AddLast(THelpImage.Create(line[1..])) + Else + list.AddLast(THelpText.Create(line)) + EndIf + Wend + + item=list.LastLink() + pos=TOP-Current().Height() + End Method + + Method Draw() + Local y:Int=pos + Local i:TLink=item + + While yTOP + item=item.PrevLink() + If Not item + item=list.LastLink() + EndIf + pos:-Current().Height() + Wend + ElseIf KeyHit(KEY_ESCAPE) + FlushKeys() + done=True + Else + del=0 + EndIf + + Flip + Wend + + SetColor(255,255,255) + End Method +End Type + +Type THelpItem Abstract + Method Height:Int() Abstract + Method Draw(y:Int) Abstract +End Type + +Type THelpText Extends THelpItem + Field txt:String + Field r:Int + Field g:Int + Field b:Int + Field sc:Int + + Function Create:THelpItem(txt:String) + Local o:THelpText=New THelpText + + Select txt[0] + Case Asc("@") + o.sc=2 + o.r=255 + o.g=255 + o.b=0 + o.txt=txt[1..] + Case Asc("!") + o.sc=1 + o.r=255 + o.g=255 + o.b=0 + o.txt=txt[1..] + Default + o.sc=1 + o.r=255 + o.g=255 + o.b=255 + o.txt=txt + End Select + + Return THelpItem(o) + End Function + + Method Height:Int() + Return GameGFX.large.MaxHeight()*sc + End Method + + Method Draw(y:Int) + SetScale(sc,sc) + GameGFX.large.Centre(txt,y,r,g,b) + SetScale(1,1) + End Method +End Type + + +Type THelpImage Extends THelpItem + Field img:TImage + Field x:Int + + Function Create:THelpItem(url:String) + Local o:THelpImage=New THelpImage + o.img=LoadImage(url) + Assert o,"Failed to load help image " + url + o.x=(GraphicsWidth()-ImageWidth(o.img))/2 + Return THelpItem(o) + End Function + + Method Height:Int() + Return ImageHeight(img) + End Method + + Method Draw(y:Int) + SetColor(255,255,255) + DrawImage(img,x,y) + End Method +End Type \ No newline at end of file diff --git a/particle.bmx b/particle.bmx index fbf2b6f..40a9c24 100644 --- a/particle.bmx +++ b/particle.bmx @@ -204,3 +204,115 @@ Type TextParticles SetScale(1,1) End Function End Type + + +Type TExplosionBase + Field p:TPixmap[4] + + Function Create:TExplosionBase(base:TImage) + Local o:TExplosionBase=New TExplosionBase + o.p=New TPixmap[4] + o.p[0]=GrabFrom(base,0,0) + o.p[1]=GrabFrom(base,16,0) + o.p[2]=GrabFrom(base,0,16) + o.p[3]=GrabFrom(base,16,16) + Return o + End Function + + Function GrabFrom:TPixmap(i:TImage,x:Int, y:Int) + Local p:TPixmap=LockImage(i) + Local ret:TPixmap=p.Copy() + ret=ResizePixmap(ret,16,16) + For Local cx:Int=0 Until 16 + For Local cy:Int=0 Until 16 + ret.WritePixel(cx,cy,p.ReadPixel(x+cx,y+cy)) + Next + Next + UnlockImage(i) + Return ret + End Function +End Type + +Type TExplosion_Old + Field x:Double + Field y:Double + Field dy:Double + Field dx:Double + Field p:TPixmap + + Function Create:TExplosion(p:TPixmap,x:Double,y:Double,dx:Double,dy:Double) + Local o:TExplosion=New TExplosion + o.x=x + o.y=y + o.dx=dx + o.dy=dy + Return o + End Function + + Method Update:Int() + DrawPixmap(p,x,y) + x:+dx + y:+dy + dy:+0.05 + Return dx>-16 And dx-16 And dx0 And a<1 + End Method + + Method Draw() + Local r:Int,g:Int,b:Int + Local oa:Double=GetAlpha() + GetColor(r,g,b) + SetAlpha(a) + SetColor(0,0,0) + DrawRect(0,0,GraphicsWidth(),GraphicsHeight()) + SetColor(r,g,b) + SetAlpha(oa) + End Method +End Type + +Type TGameBackdropStar + Field x:Double + Field y:Double + Field dy:Double + Field r:Int + Field g:Int + Field b:Int + Field frame:Int + Field cnt:Int + + Method New() + x=Rnd(0,GraphicsWidth()) + y=Rnd(0,GraphicsHeight()) + dy=Rnd(0.1,2) + r=Rand(128,255) + g=Rand(128,255) + b=Rand(128,255) + frame=Rand(0,5) + cnt=5 + End Method + + Method Draw(anim:Int) + If anim + frame=(frame+1) Mod 6 + EndIf + + y:+dy + If y>GraphicsHeight()+8 + y=-8 + EndIf + SetColor(r,g,b) + DrawImage(GameGFX.bdropstar,x,y,frame) + End Method +End Type + + +Type TGameBackdrop + Field num:Int + Field star:TGameBackdropStar[] + Field cnt:Int + + Method New() + num=100 + star=New TGameBackdropStar[num] + cnt=5 + + For Local f:Int=0 Until num + star[f]=New TGameBackdropStar + Next + End Method + + Method Draw() + For Local f:Int=0 Until num + star[f].Draw(cnt=0) + Next + cnt:-1 + If cnt=-1 + cnt=5 + EndIf + End Method +End Type \ No newline at end of file -- cgit v1.2.3