summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--GFX/bdropstar.pngbin0 -> 234 bytes
-rw-r--r--GFX/gameover.pngbin0 -> 20894 bytes
-rw-r--r--GFX/gfx.bmsbin0 -> 1609 bytes
-rw-r--r--GFX/rules_button.pngbin0 -> 7636 bytes
-rw-r--r--HELP/bomb.pngbin0 -> 1495 bytes
-rw-r--r--HELP/help.txt64
-rw-r--r--HELP/loop1.pngbin0 -> 9091 bytes
-rw-r--r--HELP/piece.pngbin0 -> 3142 bytes
-rw-r--r--HELP/pit.pngbin0 -> 869 bytes
-rw-r--r--HELP/twister.pngbin0 -> 1833 bytes
-rw-r--r--HELP/wire1.pngbin0 -> 4061 bytes
-rw-r--r--HELP/wire2.pngbin0 -> 3884 bytes
-rw-r--r--HELP/wire3.pngbin0 -> 4094 bytes
-rw-r--r--game.bmx33
-rw-r--r--gametypes.bmx9
-rw-r--r--hardwire.bmx54
-rw-r--r--help.bmx209
-rw-r--r--particle.bmx112
-rw-r--r--types.bmx172
19 files changed, 632 insertions, 21 deletions
diff --git a/GFX/bdropstar.png b/GFX/bdropstar.png
new file mode 100644
index 0000000..52437a4
--- /dev/null
+++ b/GFX/bdropstar.png
Binary files differ
diff --git a/GFX/gameover.png b/GFX/gameover.png
new file mode 100644
index 0000000..d790c26
--- /dev/null
+++ b/GFX/gameover.png
Binary files differ
diff --git a/GFX/gfx.bms b/GFX/gfx.bms
new file mode 100644
index 0000000..12ce309
--- /dev/null
+++ b/GFX/gfx.bms
Binary files differ
diff --git a/GFX/rules_button.png b/GFX/rules_button.png
new file mode 100644
index 0000000..7bdbbf4
--- /dev/null
+++ b/GFX/rules_button.png
Binary files differ
diff --git a/HELP/bomb.png b/HELP/bomb.png
new file mode 100644
index 0000000..0bb3eed
--- /dev/null
+++ b/HELP/bomb.png
Binary files 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
--- /dev/null
+++ b/HELP/loop1.png
Binary files differ
diff --git a/HELP/piece.png b/HELP/piece.png
new file mode 100644
index 0000000..c49339e
--- /dev/null
+++ b/HELP/piece.png
Binary files differ
diff --git a/HELP/pit.png b/HELP/pit.png
new file mode 100644
index 0000000..1464996
--- /dev/null
+++ b/HELP/pit.png
Binary files differ
diff --git a/HELP/twister.png b/HELP/twister.png
new file mode 100644
index 0000000..61b3e40
--- /dev/null
+++ b/HELP/twister.png
Binary files differ
diff --git a/HELP/wire1.png b/HELP/wire1.png
new file mode 100644
index 0000000..d4116c2
--- /dev/null
+++ b/HELP/wire1.png
Binary files differ
diff --git a/HELP/wire2.png b/HELP/wire2.png
new file mode 100644
index 0000000..ad44b14
--- /dev/null
+++ b/HELP/wire2.png
Binary files differ
diff --git a/HELP/wire3.png b/HELP/wire3.png
new file mode 100644
index 0000000..5e8f709
--- /dev/null
+++ b/HELP/wire3.png
Binary files 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 y<Pit.HEIGHT-1
@@ -420,6 +422,8 @@ Type TPiece_SpecialBomb Extends TSpecial
gm.path.AddLast(l)
EndIf
+ ExplosionParticles.BlowUp(Pit.X(x),Pit.Y(y))
+
Return False
End Method
End Type
@@ -438,6 +442,8 @@ Type TPiece_SpecialTwister Extends TSpecial
End Method
Method DoSpecial:Int(gm:TGameMap)
+ Draw()
+
If gm.path.Count()
Return True
EndIf
@@ -446,6 +452,7 @@ Type TPiece_SpecialTwister Extends TSpecial
rotd=60
rot:+1
If rot=5
+ ExplosionParticles.BlowUp(Pit.X(x),Pit.Y(y))
Return False
EndIf
TextParticles.Big("TWIST!")
@@ -728,7 +735,7 @@ Type TGameMap
If map[x,y]
SetColor(255,255,255)
DrawImage(GameGFX.tile,Pit.X(x),Pit.Y(y))
- SetColor(128,128,128)
+ SetColor(trode_col,trode_col,0)
DrawImage(map[x,y].Image(),Pit.X(x),Pit.Y(y))
EndIf
Next
diff --git a/hardwire.bmx b/hardwire.bmx
index 79509b2..d0cea7a 100644
--- a/hardwire.bmx
+++ b/hardwire.bmx
@@ -14,6 +14,7 @@ Import "types.bmx"
Import "gametypes.bmx"
Import "game.bmx"
Import "particle.bmx"
+Import "help.bmx"
Rem
TWire.Init()
@@ -53,16 +54,19 @@ SetAlpha(1.0)
' Globals
' ===================================
'
-GameGFX.Init()
+GameGFX.Init() ' MUST be first
+
Lookup.Init()
GameConfig.Load()
TWire.Init()
Particles.Init()
TextParticles.Init()
+ExplosionParticles.Init()
Sound.Init()
Global bdrop:TMenuBdrop=New TMenuBdrop
Global quit:Int=False
+Global last_score:Int=0
' ===================================
@@ -78,6 +82,9 @@ While Not quit
While game.Play()
Wend
+ GameConfig.Save()
+ last_score=game.score
+
Menu()
Wend
@@ -107,13 +114,14 @@ End Function
Function Menu()
Const MENU_PLAY:Int=1
Const MENU_QUIT:Int=2
- Const MENU_SCORES:Int=3
+ Const MENU_RULES:Int=3
Const MENU_KEYS:Int=4
Const MENU_LEFT:Int=5
Const MENU_RIGHT:Int=6
+ Local fade:TFadeScreen=TFadeScreen.FadeIn()
Local done:Int=False
- Local menu:TGfxMenu=TGfxMenu.Create(200,0,0,255,255,255,25,bdrop,1)
+ Local menu:TGfxMenu=TGfxMenu.Create(255,0,0,255,255,255,25,bdrop,1)
Local sel:Int
Local defkey:Int=0
@@ -122,7 +130,7 @@ Function Menu()
Local x2:Int=GraphicsWidth()/3*2-ImageWidth(GameGFX.play_button)/2
menu.Add(x1,150,GameGFX.play_button,MENU_PLAY)
- menu.Add(x2,150,GameGFX.scores_button,MENU_SCORES)
+ menu.Add(x2,150,GameGFX.rules_button,MENU_RULES)
menu.Add(x1,250,GameGFX.keys_button,MENU_KEYS)
menu.Add(x2,250,GameGFX.quit_button,MENU_QUIT)
menu.Add(x1,350,GameGFX.left_button,MENU_LEFT)
@@ -131,9 +139,20 @@ Function Menu()
Local tx1:Int=(GraphicsWidth()-GameGFX.large.TextWidth("START LEVEL 1"))/2
Local tx2:Int=tx1+GameGFX.large.TextWidth("START LEVEL ")
+ Local col:Int=128
+ Local coli=1
+
While Not done
Cls
+ SetColor(col,col,255)
DrawImage(GameGFX.title,0,0)
+ SetColor(255,255,255)
+
+ col:+coli
+
+ If col=128 Or col=255
+ coli=-coli
+ EndIf
sel=menu.Render(defkey>0)
@@ -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 y<BOTTOM
+ Local h:THelpItem=THelpItem(i.Value())
+ h.Draw(y)
+ y:+h.Height()
+ i=i.NextLink()
+ If Not i
+ i=list.FirstLink()
+ EndIf
+ Wend
+
+ SetColor(0,0,0)
+ DrawRect(0,0,GraphicsWidth(),TOP)
+ DrawRect(0,BOTTOM,GraphicsWidth(),GraphicsHeight()-BOTTOM)
+ For Local f:Int=0 To 8
+ SetAlpha(1.0-f*0.125)
+ DrawLine(0,TOP+f,GraphicsWidth(),TOP+f)
+ DrawLine(0,BOTTOM-f,GraphicsWidth(),BOTTOM-f)
+ Next
+ SetAlpha(1)
+ SetColor(128,128,128)
+ DrawLine(0,TOP-1,GraphicsWidth(),TOP-1)
+ DrawLine(0,TOP+1,GraphicsWidth(),TOP+1)
+ DrawLine(0,BOTTOM-1,GraphicsWidth(),BOTTOM-1)
+ DrawLine(0,BOTTOM+1,GraphicsWidth(),BOTTOM+1)
+ SetColor(255,255,255)
+ DrawLine(0,TOP,GraphicsWidth(),TOP)
+ DrawLine(0,BOTTOM,GraphicsWidth(),BOTTOM)
+
+ GameGFX.large.Centre("HOW TO PLAY HARDWIRE",0,255,255,0)
+ GameGFX.large.Centre("USE UP/DOWN CURSORS TO SCROLL",BOTTOM+10,255,255,0)
+ GameGFX.large.Centre("ESCAPE TO EXIT",BOTTOM+30,255,255,0)
+ End Method
+
+ Method Current:THelpItem()
+ Return THelpItem(item.Value())
+ End Method
+
+ Method Show()
+ Local done:Int=False
+
+ While Not done
+ Cls
+
+ Draw()
+
+ If KeyDown(KEY_DOWN)
+ del=Min(del+1,200)
+ pos:-del/4+1
+ While pos<TOP-Current().Height()
+ pos:+Current().Height()
+ item=item.NextLink()
+ If Not item
+ item=list.FirstLink()
+ EndIf
+ Wend
+ ElseIf KeyDown(KEY_UP)
+ del=Min(del+1,200)
+ pos:+del/4+1
+ While pos>TOP
+ 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<GraphicsWidth()+16 And y<GraphicsHeight()
+ End Method
+End Type
+
+Type TExplosion
+ Field x:Double
+ Field y:Double
+ Field dy:Double
+ Field dx:Double
+
+ Function Create:TExplosion(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()
+ SetColor(Rand(0,255),Rand(0,255),Rand(0,255))
+ Plot(x,y)
+ x:+dx
+ y:+dy
+ dy:+0.1
+ Return dx>-16 And dx<GraphicsWidth()+16 And y<GraphicsHeight()
+ End Method
+End Type
+
+Type ExplosionParticles
+ Global plist:TList
+
+ Function Init()
+ plist=CreateList()
+ End Function
+
+ Function Clear()
+ plist.Clear()
+ End Function
+
+ Function BlowUp(x:Int, y:Int)
+ For Local cx:Int=0 Until 32
+ For Local cy:Int=0 Until 32
+ plist.AddLast(TExplosion.Create(x+cx,y+cy,Rnd(-2,2),Rnd(-2,2)))
+ Next
+ Next
+ End Function
+
+ Function Draw()
+ Local l:TEasyLink=TEasyLink.Create(plist)
+
+ While l.Value()
+ Local p:TExplosion=TExplosion(l.Value())
+
+ If (p.Update())
+ l.MoveNext()
+ Else
+ l.Remove()
+ EndIf
+ Wend
+ End Function
+End Type \ No newline at end of file
diff --git a/types.bmx b/types.bmx
index c5ca14f..c4211ef 100644
--- a/types.bmx
+++ b/types.bmx
@@ -4,6 +4,9 @@
'
' $Id$
'
+'
+' This should really be called Global.bmx probably...
+'
Strict
Import noddybox.bitmapfont
Import noddybox.gfxmenu
@@ -17,8 +20,8 @@ Incbin "GFX/large.bmf"
Incbin "GFX/pointer.png"
Incbin "GFX/play_button.png"
Incbin "GFX/quit_button.png"
-Incbin "GFX/scores_button.png"
Incbin "GFX/keys_button.png"
+Incbin "GFX/rules_button.png"
Incbin "GFX/left_button.png"
Incbin "GFX/right_button.png"
Incbin "GFX/copper.png"
@@ -26,6 +29,7 @@ Incbin "GFX/copperslice.png"
Incbin "GFX/dust.png"
Incbin "GFX/title.png"
Incbin "GFX/gameover.png"
+Incbin "GFX/bdropstar.png"
Incbin "TILES/tile.png"
Incbin "TILES/pit_top.png"
@@ -82,7 +86,7 @@ Type GameGFX
Global quit_button:TImage
Global left_button:TImage
Global right_button:TImage
- Global scores_button:TImage
+ Global rules_button:TImage
Global keys_button:TImage
Global tile:TImage
@@ -108,6 +112,8 @@ Type GameGFX
Global special_bomb:TImage
Global special_twister:TImage
+ Global bdropstar:TImage
+
Function SafeLoadImage:TImage(p:String, mode:Int)
Local i:TImage=LoadImage(p,mode)
Assert i,"Failed to load " + p
@@ -143,7 +149,7 @@ Type GameGFX
play_button=SafeLoadImage("incbin::GFX/play_button.png",0)
quit_button=SafeLoadImage("incbin::GFX/quit_button.png",0)
- scores_button=SafeLoadImage("incbin::GFX/scores_button.png",0)
+ rules_button=SafeLoadImage("incbin::GFX/rules_button.png",0)
keys_button=SafeLoadImage("incbin::GFX/keys_button.png",0)
left_button=SafeLoadImage("incbin::GFX/left_button.png",0)
right_button=SafeLoadImage("incbin::GFX/right_button.png",0)
@@ -168,8 +174,10 @@ Type GameGFX
bottom_left=SafeLoadImage("incbin::TILES/bottom_left.png",0)
bottom_right=SafeLoadImage("incbin::TILES/bottom_right.png",0)
- special_bomb=SafeLoadAnimImage("incbin::TILES/special_bomb.png",32,32,0,4,0)
- special_twister=SafeLoadAnimImage("incbin::TILES/special_twister.png",32,32,0,4,0)
+ special_bomb=SafeLoadAnimImage("incbin::TILES/special_bomb.png",32,32,0,4,DYNAMICIMAGE)
+ special_twister=SafeLoadAnimImage("incbin::TILES/special_twister.png",32,32,0,4,DYNAMICIMAGE)
+
+ bdropstar=SafeLoadAnimImage("incbin::GFX/bdropstar.png",8,8,0,6,0)'FILTEREDIMAGE)
End Function
End Type
@@ -181,6 +189,7 @@ Type GameConfig
Global kdrop:Int
Global kpause:Int
Global start_level:Int
+ Global hiscore:Int
Function Load()
Local s:TStream=ReadStream("hardwire.config")
@@ -193,6 +202,7 @@ Type GameConfig
kdrop=KEY_SPACE
kpause=KEY_P
start_level=1
+ hiscore=0
Return
EndIf
@@ -205,6 +215,7 @@ Type GameConfig
kdrop=s.ReadInt()
kpause=s.ReadInt()
start_level=s.ReadInt()
+ hiscore=s.ReadInt()
s.Close()
End Function
@@ -225,6 +236,7 @@ Type GameConfig
s.WriteInt(kdrop)
s.WriteInt(kpause)
s.WriteInt(start_level)
+ s.WriteInt(hiscore)
s.Close()
End Function
@@ -261,8 +273,8 @@ Type TEasyLink
End Type
-Type TMenuBdrop Extends TGfxMenuBackdrop
- Const NUM:Int=2
+Type TMenuBdrop_Orig Extends TGfxMenuBackdrop
+ Const NUM:Int=3
Const SIZE:Double=50.0
Const OFFSET:Double=500.0
Field a:Int[NUM]
@@ -277,12 +289,13 @@ Type TMenuBdrop Extends TGfxMenuBackdrop
Next
msg=" "
- msg:+"Welcome to Hardwire. The object of the game is to connect the electrodes around the side of the pit using "
- msg:+"the wires embedded in the blocks. Once a circuit is completed those blocks are removed. Once in a while new blocks will fall from the sky. "
- msg:+"If you let the pit overflow the game is over. That's all there is to it... "
+ msg:+"Welcome to Hardwire. "
+ 'msg:+"Welcome to Hardwire. The object of the game is to connect the electrodes around the side of the pit using "
+ 'msg:+"the wires embedded in the blocks. "
+ 'msg:+"If you let the pit overflow the game is over. That's all there is to it... Press the RULES button for help on how to play. "
msg:+"Hardwire was written using BlitzMax -- http://www.blitzbasic.com/ -- and a variety of tools available at "
- msg:+"http://www.noddybox.demon.co.uk/ Please feel free to forward this game on to whoever you despise enough "
- msg:+"to inflict this monstrosity upon. Enjoy."
+ msg:+"http://www.noddybox.demon.co.uk/ Please feel free to forward this game to whoever you hate enough "
+ msg:+"to inflict this monstrosity upon. Enjoy. This game written under the influence of Slay Radio -- http://www.slayradio.org"
msgx=0
msgp=0
@@ -321,3 +334,138 @@ Type TMenuBdrop Extends TGfxMenuBackdrop
SetColor(255,255,255)
End Method
End Type
+
+Type TMenuBdrop Extends TGfxMenuBackdrop
+ Field msg:String
+ Field msgp:Int
+ Field msgx:Int
+ Field msgy:Int
+
+ Method New()
+ msg=" "
+ msg=" "
+ msg:+"Welcome to Hardwire. "
+ 'msg:+"Welcome to Hardwire. The object of the game is to connect the electrodes around the side of the pit using "
+ 'msg:+"the wires embedded in the blocks. "
+ 'msg:+"If you let the pit overflow the game is over. That's all there is to it... Press the RULES button for help on how to play. "
+ msg:+"Hardwire was written using BlitzMax -- http://www.blitzbasic.com/ -- and a variety of tools available at "
+ msg:+"http://www.noddybox.demon.co.uk/ Please feel free to forward this game to whoever you hate enough "
+ msg:+"to inflict this monstrosity upon. Enjoy. This game written under the influence of Slay Radio -- http://www.slayradio.org"
+
+ msgx=0
+ msgp=0
+ msgy=560
+ End Method
+
+ Method Create:TGfxMenuBackdrop()
+ Return Self
+ End Method
+
+ Method Update()
+ GameGFX.large.Draw(msg[..80],msgx,msgy)
+
+ msgx:-2
+ If msgx<-GameGFX.large.TextWidth(msg[0..1])
+ msgx:+GameGFX.large.TextWidth(msg[0..1])
+ msg=msg[1..]+msg[0..1]
+ EndIf
+ End Method
+End Type
+
+Type TFadeScreen
+ Field a:Double
+ Field ai:Double
+
+ Function Create:TFadeScreen(a:Double, ai:Double)
+ Local o:TFadeScreen=New TFadeScreen
+ o.a=a
+ o.ai=ai
+ Return o
+ End Function
+
+ Function FadeOut:TFadeScreen()
+ Return Create(0,0.05)
+ End Function
+
+ Function FadeIn:TFadeScreen()
+ Return Create(1,-0.05)
+ End Function
+
+ Method Fade:Int()
+ a:+ai
+ Return a>0 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