summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--GFX/font.bmfbin21036 -> 173208 bytes
-rw-r--r--TILES/special_bomb.pngbin0 -> 657 bytes
-rw-r--r--TILES/special_twister.pngbin0 -> 712 bytes
-rw-r--r--TILES/tiles.bmsbin70074 -> 98831 bytes
-rw-r--r--game.bmx51
-rw-r--r--gametypes.bmx440
-rw-r--r--hardwire.bmx31
-rw-r--r--particle.bmx105
-rw-r--r--sounds.bmx22
-rw-r--r--types.bmx14
10 files changed, 424 insertions, 239 deletions
diff --git a/GFX/font.bmf b/GFX/font.bmf
index 364f158..ecdc1b4 100644
--- a/GFX/font.bmf
+++ b/GFX/font.bmf
Binary files differ
diff --git a/TILES/special_bomb.png b/TILES/special_bomb.png
new file mode 100644
index 0000000..e182696
--- /dev/null
+++ b/TILES/special_bomb.png
Binary files differ
diff --git a/TILES/special_twister.png b/TILES/special_twister.png
new file mode 100644
index 0000000..1446d1b
--- /dev/null
+++ b/TILES/special_twister.png
Binary files differ
diff --git a/TILES/tiles.bms b/TILES/tiles.bms
index d367fb0..779a0c3 100644
--- a/TILES/tiles.bms
+++ b/TILES/tiles.bms
Binary files differ
diff --git a/game.bmx b/game.bmx
index 606c014..94edada 100644
--- a/game.bmx
+++ b/game.bmx
@@ -18,6 +18,7 @@ Type TGame
Field alpha:Double
Field alphainc:Double
Field count:Int
+ Field total:Int
Field block:TPiece
Field nextblock:TPiece
Field drop:Int
@@ -27,12 +28,14 @@ Type TGame
gm=New TGameMap
level=1
Particles.Clear()
- alpha=0.7
+ TextParticles.Clear()
+ alpha=0.0
alphainc=0.01
count=0
- nextblock=TPiece.Create()
+ total=0
+ nextblock=TPiece.Create(False)
drop=False
- CreateNext()
+ CreateNext(False)
End Method
Method SetInitLevel(l:Int)
@@ -53,11 +56,11 @@ Type TGame
count=0
End Method
- Method CreateNext()
+ Method CreateNext(special:Int)
block=nextblock
- block.y=-4
+ block.y=-3
block.x=Pit.WIDTH/2
- nextblock=TPiece.Create()
+ nextblock=TPiece.Create(special)
nextblock.x=Pit.WIDTH+3
nextblock.y=1
drop=False
@@ -112,15 +115,18 @@ Type TGame
Cls
- GameGFX.large.DrawColoured("SCORE",0,0,255,255,0)
+ TextParticles.Draw()
+
+ GameGFX.large.Draw("SCORE",0,0,255,255,0)
GameGFX.large.Draw(score,0,20)
- GameGFX.large.DrawColoured("LEVEL",0,100,255,255,0)
+ GameGFX.large.Draw("LEVEL",0,100,255,255,0)
GameGFX.large.Draw(level,0,120)
-
- GameGFX.large.DrawColoured("NEXT",Pit.X(Pit.WIDTH+2),Pit.Y(-1),255,255,0)
+
nextblock.Draw()
+ block.Draw()
+
If Not gm.overflow
If KeyHit(KEY_ESCAPE)
playing=False
@@ -137,12 +143,16 @@ Type TGame
block.y:-1
block.AddToMap(gm)
count:+1
+ total:+1
If count>10
LevelUp()
EndIf
If Not gm.overflow
- CreateNext()
+ score:+level*2
+ CreateNext((total Mod 30)=0)
+ Else
+ FlushKeys()
EndIf
EndIf
EndIf
@@ -164,14 +174,22 @@ Type TGame
If KeyHit(GameConfig.krotright)
block.RotateRight()
If block.Collides(gm)
- block.RotateLeft()
+ block.x:-1
+ If block.Collides(gm)
+ block.x:+1
+ block.RotateLeft()
+ EndIf
EndIf
EndIf
If KeyHit(GameConfig.krotleft)
block.RotateLeft()
If block.Collides(gm)
- block.RotateRight()
+ block.x:+1
+ If block.Collides(gm)
+ block.x:-1
+ block.RotateRight()
+ EndIf
EndIf
EndIf
@@ -181,9 +199,7 @@ Type TGame
EndIf
EndIf
- block.Draw()
-
- score:+gm.Draw()*level*10
+ score:+gm.Draw()*level*20
Else
gm.Draw()
@@ -192,7 +208,7 @@ Type TGame
DrawImage(GameGFX.gameover,GraphicsWidth()/2,GraphicsHeight()/2)
SetAlpha(1)
alpha:+alphainc
- If alpha<=0.7 Or alpha>=1.0
+ If (alpha<=0.7 And alphainc<0) Or (alpha>=1.0 And alphainc>0)
alpha=Max(0,Min(1,alpha))
alphainc=-alphainc
EndIf
@@ -208,6 +224,7 @@ Type TGame
Pause()
EndIf
+ Sound.Process()
Flip
Return playing
diff --git a/gametypes.bmx b/gametypes.bmx
index 8866f5e..004e69e 100644
--- a/gametypes.bmx
+++ b/gametypes.bmx
@@ -11,14 +11,14 @@ Import "sounds.bmx"
Type Pit
Const WIDTH=10
- Const HEIGHT=14
+ Const HEIGHT=13
Function X:Int(p:Int)
Return 230+p*32
End Function
Function Y:Int(p:Int)
- Return 96+p*32
+ Return 120+p*32
End Function
End Type
@@ -30,6 +30,8 @@ Type TWire
Const TOP_RIGHT:Int=4
Const BOTTOM_LEFT:Int=5
Const BOTTOM_RIGHT:Int=6
+ Const SPECIAL_BOMB:Int=7
+ Const SPECIAL_TWISTER:Int=8
Const DIR_NONE:Int=0
Const DIR_UP:Int=1
@@ -50,19 +52,19 @@ Type TWire
Field t:Int
Function Init()
- rotright=[0,2,1,4,6,3,5]
- rotleft=[0,2,1,5,3,6,4]
+ rotright=[0,2,1,4,6,3,5,7,8]
+ rotleft=[0,2,1,5,3,6,4,7,8]
- img=[GameGFX.cross,GameGFX.left_right,GameGFX.top_bottom,GameGFX.top_left,GameGFX.top_right,GameGFX.bottom_left,GameGFX.bottom_right]
+ img=[GameGFX.cross,GameGFX.left_right,GameGFX.top_bottom,GameGFX.top_left,GameGFX.top_right,GameGFX.bottom_left,GameGFX.bottom_right,GameGFX.special_bomb,GameGFX.special_twister]
- ' CROSS LEFT_RIGHT TOP_BOTTOM TOP_LEFT TOP_RIGHT BOTTOM_LEFT BOTTOM_RIGHT
- dir=[[DIR_UP,DIR_RIGHT,DIR_DOWN,DIR_LEFT], [DIR_NONE,DIR_RIGHT,DIR_NONE,DIR_LEFT], [DIR_UP,DIR_NONE,DIR_DOWN,DIR_NONE], [DIR_NONE,DIR_UP,DIR_LEFT,DIR_NONE], [DIR_NONE,DIR_NONE,DIR_RIGHT,DIR_UP], [DIR_LEFT,DIR_DOWN,DIR_NONE,DIR_NONE], [DIR_RIGHT,DIR_NONE,DIR_NONE,DIR_DOWN]]
+ ' CROSS LEFT_RIGHT TOP_BOTTOM TOP_LEFT TOP_RIGHT BOTTOM_LEFT BOTTOM_RIGHT SPECIAL_BOMB SPECIAL_TWISTER
+ dir=[[DIR_UP,DIR_RIGHT,DIR_DOWN,DIR_LEFT], [DIR_NONE,DIR_RIGHT,DIR_NONE,DIR_LEFT], [DIR_UP,DIR_NONE,DIR_DOWN,DIR_NONE], [DIR_NONE,DIR_UP,DIR_LEFT,DIR_NONE], [DIR_NONE,DIR_NONE,DIR_RIGHT,DIR_UP], [DIR_LEFT,DIR_DOWN,DIR_NONE,DIR_NONE], [DIR_RIGHT,DIR_NONE,DIR_NONE,DIR_DOWN], [DIR_NONE,DIR_NONE,DIR_NONE,DIR_NONE], [DIR_NONE,DIR_NONE,DIR_NONE,DIR_NONE]]
dx=[0,0,1,0,-1]
dy=[0,-1,0,1,0]
dirname=["NONE","UP","RIGHT","DOWN","LEFT"]
- typename=["CROSS","LEFT_RIGHT","TOP_BOTTOM","TOP_LEFT","TOP_RIGHT","BOTTOM_LEFT","BOTTOM_RIGHT"]
+ typename=["CROSS","LEFT_RIGHT","TOP_BOTTOM","TOP_LEFT","TOP_RIGHT","BOTTOM_LEFT","BOTTOM_RIGHT","SPECIAL BOMB","SPECIAL TWISTER"]
End Function
Method New()
@@ -113,55 +115,106 @@ Type TPiece Abstract
Field rot:Int
Field offx:Int[4]
Field offy:Int[4]
+ Field special:Int
+ Field special_pulse:Int
+ Field col:Int
+ Field coli:Int
+ Field frame:Int
+ Field framed:Int
- Function Create:TPiece()
+ Function Create:TPiece(special:Int)
Local o:TPiece
- Select Rand(0,5)
- Case 0
- o=TPiece(New TPiece_S_Left)
- Case 1
- o=TPiece(New TPiece_S_Right)
- Case 2
- o=TPiece(New TPiece_L_Left)
- Case 3
- o=TPiece(New TPiece_L_Right)
- Case 4
- o=TPiece(New TPiece_Square)
- Case 5
- o=TPiece(New TPiece_Bar)
- End Select
-
- o.BaseInit()
+ If special
+ Select Rand(0,5)
+ Case 0
+ o=TPiece(New TPiece_SpecialBomb)
+ Case 1
+ o=TPiece(New TPiece_SpecialTwister)
+ End Select
+ Else
+ Select Rand(0,5)
+ Case 0
+ o=TPiece(New TPiece_S_Left)
+ Case 1
+ o=TPiece(New TPiece_S_Right)
+ Case 2
+ o=TPiece(New TPiece_L_Left)
+ Case 3
+ o=TPiece(New TPiece_L_Right)
+ Case 4
+ o=TPiece(New TPiece_Square)
+ Case 5
+ o=TPiece(New TPiece_Bar)
+ End Select
+ EndIf
+
+ o.BaseInit(special)
Return o
End Function
Method Init() Abstract
- Method BaseInit()
+ Method BaseInit(special:Int)
+ special_pulse=False
Init()
rot=0
ox=offx[rot]
oy=offy[rot]
+ self.special=special
+ col=255
+ coli=-1
+ frame=0
+ framed=0
End Method
Method Draw()
- For Local px:Int=0 Until 4
- For Local py:Int=0 Until 4
- If map[px,py]
- Local gx:Int=Pit.X(x-ox+px)
- Local gy:Int=Pit.Y(y-oy+py)
- SetColor(255,255,255)
- DrawImage(GameGFX.tile,gx,gy)
- SetColor(128,128,128)
- DrawImage(map[px,py].Image(),gx,gy)
- EndIf
+ If special
+ col:+coli
+ If col=255 Or col=128
+ coli=-coli
+ EndIf
+
+ framed:+1
+ If framed=5
+ framed=0
+ frame=(frame+1) Mod 4
+ EndIf
+
+ For Local px:Int=0 Until 4
+ For Local py:Int=0 Until 4
+ If map[px,py]
+ Local gx:Int=Pit.X(x-ox+px)
+ Local gy:Int=Pit.Y(y-oy+py)
+ SetColor(255,255,255)
+ DrawImage(GameGFX.tile,gx,gy)
+ If special_pulse
+ SetColor(col,col/2,255-col)
+ EndIf
+ DrawImage(map[px,py].Image(),gx,gy,frame)
+ EndIf
+ Next
Next
- Next
+ Else
+ For Local px:Int=0 Until 4
+ For Local py:Int=0 Until 4
+ If map[px,py]
+ Local gx:Int=Pit.X(x-ox+px)
+ Local gy:Int=Pit.Y(y-oy+py)
+ SetColor(255,255,255)
+ DrawImage(GameGFX.tile,gx,gy)
+ SetColor(128,128,128)
+ DrawImage(map[px,py].Image(),gx,gy)
+ EndIf
+ Next
+ Next
+ EndIf
End Method
Method RotateLeft()
+ If special Then Return
+
If rot=0
rot=3
Else
@@ -186,6 +239,8 @@ Type TPiece Abstract
End Method
Method RotateRight()
+ If special Then Return
+
rot=(rot+1) Mod 4
ox=offx[rot]
@@ -227,26 +282,44 @@ Type TPiece Abstract
End Method
Method AddToMap(gm:TGameMap)
- For Local px:Int=0 Until 4
- For Local py:Int=0 Until 4
- If map[px,py]
- Local gx:Int=x-ox+px
- Local gy:Int=y-oy+py
-
- If gy<0
- gm.overflow=True
- Else
- gm.map[gx,gy]=map[px,py]
- Particles.AddDust(Pit.X(gx)+16,Pit.Y(gy)+32)
+ If special
+ gm.SetSpecial(TSpecial(Self))
+ Else
+ For Local px:Int=0 Until 4
+ For Local py:Int=0 Until 4
+ If map[px,py]
+ Local gx:Int=x-ox+px
+ Local gy:Int=y-oy+py
+
+ If gy<0
+ gm.overflow=True
+ Else
+ gm.map[gx,gy]=map[px,py]
+
+ If gy=Pit.HEIGHT-1 Or gm.map[gx,gy+1]
+ Particles.AddDust(Pit.X(gx)+16,Pit.Y(gy)+32)
+ EndIf
+ EndIf
EndIf
- EndIf
+ Next
Next
- Next
- Sound.Click()
- gm.CheckWires()
+
+ Sound.Click()
+
+ If Not gm.overflow
+ If Not gm.CheckWires()
+ gm.Flatten()
+ gm.CheckWires()
+ EndIf
+ EndIf
+ EndIf
End Method
End Type
+Type TSpecial Extends TPiece Abstract
+ Method DoSpecial:Int(gm:TGameMap) Abstract
+End Type
+
Type TPiece_S_Right Extends TPiece
Method Init()
map[1,0]=TWire.Create([TWire.CROSS,TWire.BOTTOM_RIGHT])
@@ -318,32 +391,49 @@ Type TPiece_Bar Extends TPiece
End Method
End Type
-
-Type TFallingBlock
- Field w:TWire
- Field x:Int
- Field y:Double
- Field yi:Double
+Type TPiece_SpecialBomb Extends TSpecial
+ Method Init()
+ map[0,0]=TWire.Create([TWire.SPECIAL_BOMB])
+ offx=[0,0,0,0]
+ offy=[0,0,0,0]
+ End Method
- Function Create:TFallingBlock(x:Int, y:Double)
- Local o:TFallingBlock=New TFallingBlock
- o.w=New TWire
- o.x=x
- o.y=y
- o.yi=0
- Return o
- End Function
+ Method DoSpecial:Int(gm:TGameMap)
+ Local l:TWireList=New TWireList
- Method Update()
- y:+yi
- yi=Max(4.0,yi+0.1)
+ If y<Pit.HEIGHT-1
+ Local t:Int=map[x,y+1].t
+
+ For Local px:Int=0 Until Pit.WIDTH
+ For Local py:Int=0 Until Pit.HEIGHT
+ If gm.map[px,py] And map[px,py].t=t
+ l.Add(px,py,gm.map[px,py])
+ EndIf
+ Next
+ Next
+ EndIf
+
+ If l.Count()=0
+ TextParticles.Big("WHAT A WASTE!",255,0,0)
+ Else
+ TextParticles.Big("SPECIAL GOT " + (l.Count()-1) + " BLOCKS!",255,255,0)
+ EndIf
+
+ gm.path.AddLast(l)
+
+ Return False
+ End Method
+End Type
+
+Type TPiece_SpecialTwister Extends TSpecial
+ Method Init()
+ special_pulse=True
+ map[0,0]=TWire.Create([TWire.SPECIAL_TWISTER])
+ offx=[0,0,0,0]
+ offy=[0,0,0,0]
End Method
- Method Draw()
- SetColor(255,255,255)
- DrawImage(GameGFX.tile,Pit.X(x),y)
- SetColor(128,128,128)
- DrawImage(w.Image(),Pit.X(x),y)
+ Method DoSpecial:Int(gm:TGameMap)
End Method
End Type
@@ -377,7 +467,7 @@ Type TWireList
End Method
Method Draw:Int()
- col=Max(255,col+5)
+ col=Min(255,col+5)
SetColor(col,col,col)
For Local e:TWireListEnt=EachIn list
DrawImage(e.w.Image(),Pit.X(e.x),Pit.Y(e.y))
@@ -392,52 +482,33 @@ Type TWireList
Return False
EndIf
End Method
+
+ Method Count:Int()
+ Return list.Count()
+ End Method
End Type
+
Type TGameMap
Field map:TWire[Pit.WIDTH,Pit.HEIGHT]
Field trode_col:Int
Field trode_coli:Int
Field overflow:Int
- Field top:Int[Pit.WIDTH]
- Field drop:TList
Field cx:Int
Field cy:Int
Field path:TList
+ Field special:TSpecial
Method New()
trode_col=0
trode_coli=1
overflow=False
- drop=CreateList()
path=CreateList()
- CalcTop()
- cx=0
- cy=Pit.HEIGHT-2
- End Method
-
- Method CalcTop()
- For Local x:Int=0 Until Pit.WIDTH
- top[x]=-1
- For Local y:Int=Pit.Height-1 To 0 Step -1
- If Not map[x,y]
- top[x]=y
- Exit
- EndIf
- Next
- Next
- End Method
-
- Method AddRow(y:Int=-32)
- If BlockInteract() Then Return
-
- For Local x:Int=0 Until Pit.WIDTH
- drop.AddLast(TFallingBlock.Create(x,y))
- Next
+ special=Null
End Method
Method BlockInteract:Int()
- Return overflow Or path.Count()
+ Return overflow Or path.Count() Or special
End Method
Method FindPath:Int(l:TWireList, x:Int, y:Int, dir:Int)
@@ -488,14 +559,17 @@ Type TGameMap
x:+TWire.DirX(dir)
y:+TWire.DirY(dir)
- If x=ox And y=oy And dir=TWire.DIR_LEFT
+ If x=ox And y=oy And dir=TWire.DIR_RIGHT
Return True
EndIf
Return FindLoop(l,ox,oy,x,y,dir)
End Method
- Method CheckWires()
+ Method CheckWires:Int()
+ Local loop:Int=False
+ Local wire:Int=False
+
For Local y:Int=0 Until Pit.HEIGHT
Local l:TWireList=New TWireList
@@ -507,6 +581,7 @@ Type TGameMap
If FindPath(l,Pit.WIDTH-1,y,TWire.DIR_LEFT)
path.AddLast(l)
+ wire=True
EndIf
Next
@@ -515,6 +590,7 @@ Type TGameMap
If FindPath(l,x,Pit.HEIGHT-1,TWire.DIR_UP)
path.AddLast(l)
+ wire=True
EndIf
Next
@@ -524,52 +600,61 @@ Type TGameMap
Local l:TWireList=New TWireList
Select map[x,y].t
Case TWire.CROSS, TWire.LEFT_RIGHT, TWire.TOP_LEFT, TWire.BOTTOM_LEFT
- If FindLoop(l,x,y,x,y,TWire.DIR_LEFT)
+ If FindLoop(l,x,y,x,y,TWire.DIR_RIGHT)
path.AddLast(l)
+ loop=True
EndIf
End Select
EndIf
Next
Next
+
+ If loop And wire
+ TextParticles.Big("LOOP AND WIRE",255,0,255)
+ ElseIf loop
+ TextParticles.Big("LOOP",255,0,255)
+ ElseIf wire
+ TextParticles.Big("WIRE",255,0,255)
+ EndIf
+
+ Return loop Or wire
End Method
- Method CursorLeft()
- If BlockInteract() Then Return
- cx=Max(0,cx-1)
- End Method
-
- Method CursorRight()
- If BlockInteract() Then Return
- cx=Min(Pit.WIDTH-2,cx+1)
- End Method
-
- Method CursorUp()
- If BlockInteract() Then Return
- cy=Max(0,cy-1)
+ Method SetSpecial(s:TSpecial)
+ special=s
End Method
- Method CursorDown()
- If BlockInteract() Then Return
- cy=Min(Pit.HEIGHT-2,cy+1)
+ Method FlattenColumn(x:Int, y:Int)
+ Local diff:Int=0
+
+ For Local cy:Int=y-1 To 0 Step -1
+ If map[x,cy]
+ diff=y-cy
+ Exit
+ EndIf
+ Next
+
+ If diff
+ For Local cy:Int=y To diff Step -1
+ map[x,cy]=map[x,cy-diff]
+ Next
+ For Local cy:Int=diff To 0 Step -1
+ map[x,cy]=Null
+ Next
+ EndIf
+
+ Return diff
End Method
- Method Rotate()
- If BlockInteract() Then Return
- Local done:Int=False
- For Local x:Int=0 To 1
- For Local y:Int=0 To 1
- If map[cx+x,cy+y]
- map[cx+x,cy+y].RotateRight()
- done=True
+ Method Flatten()
+ For Local x:Int=0 Until Pit.WIDTH
+ For Local y:Int=Pit.HEIGHT-1 To 1 Step -1
+ If Not map[x,y] And FlattenColumn(x,y)
+ Particles.AddDust(Pit.X(x)+16,Pit.Y(y)+32)
+ Sound.Click()
EndIf
Next
Next
-
- If done
- Sound.Click()
- EndIf
-
- CheckWires()
End Method
Method Draw:Int()
@@ -612,73 +697,30 @@ Type TGameMap
Next
Next
- If BlockInteract()
- For Local b:TFallingBlock=EachIn drop
- b.Draw()
- Next
-
- Local l:TEasyLink=TEasyLink.Create(path)
- Local check:Int=False
-
- While l.Value()
- Local b:TWireList=TWireList(l.Value())
-
- If b.Draw()
- l.MoveNext()
- Else
- If Not overflow
- score:+b.list.Count()
- For Local e:TWireListEnt=EachIn b.list
- For Local y:Int=e.y To 1 Step -1
- map[e.x,y]=map[e.x,y-1]
- Next
- map[e.x,0]=Null
- Particles.AddDust(Pit.X(e.x)+16,Pit.Y(e.y)+32)
- check=True
- Next
- EndIf
- l.Remove()
- EndIf
- Wend
-
- If check
- Sound.Path()
- CalcTop()
- CheckWires()
- EndIf
- Else
- Local hit:Int=False
-
- Local l:TEasyLink=TEasyLink.Create(drop)
+ Local l:TEasyLink=TEasyLink.Create(path)
+ Local check:Int=False
+
+ While l.Value()
+ Local b:TWireList=TWireList(l.Value())
- While l.Value()
- Local b:TFallingBlock=TFallingBlock(l.Value())
- Local t:Int=Pit.Y(top[b.x])'-ImageHeight(GameGFX.tile)
-
- b.Update()
-
- If b.y>t
- If top[b.x]=-1
- overflow=True
- b.y=t
- l.MoveNext()
- Else
- hit=True
- map[b.x,top[b.x]]=b.w
- Particles.AddDust(Pit.X(b.x)+16,Pit.Y(top[b.x])+32)
- l.Remove()
- EndIf
- Else
- b.Draw()
- l.MoveNext()
+ If b.Draw()
+ l.MoveNext()
+ Else
+ If Not overflow
+ score:+b.list.Count()
+ For Local e:TWireListEnt=EachIn b.list
+ map[e.x,e.y]=Null
+ Next
EndIf
- Wend
-
- If hit And Not overflow
- Sound.Click()
- CheckWires()
- CalcTop()
+ l.Remove()
+ check=True
EndIf
+ Wend
+
+ If check
+ Sound.Path()
+ Flatten()
+ CheckWires()
EndIf
trode_col:+trode_coli
diff --git a/hardwire.bmx b/hardwire.bmx
index 7a9a8a5..79509b2 100644
--- a/hardwire.bmx
+++ b/hardwire.bmx
@@ -58,6 +58,7 @@ Lookup.Init()
GameConfig.Load()
TWire.Init()
Particles.Init()
+TextParticles.Init()
Sound.Init()
Global bdrop:TMenuBdrop=New TMenuBdrop
@@ -152,18 +153,18 @@ Function Menu()
Local c5:Int=128+128*(defkey=5)
Local c6:Int=128+128*(defkey=6)
- GameGFX.large.DrawColoured("Left",250,180,c1,c1,0)
- GameGFX.large.DrawColoured("Right",250,210,c2,c2,0)
- GameGFX.large.DrawColoured("Rotate Right",250,240,c3,c3,0)
- GameGFX.large.DrawColoured("Rotate Left",250,270,c4,c4,0)
- GameGFX.large.DrawColoured("Drop",250,300,c5,c5,0)
- GameGFX.large.DrawColoured("Pause",250,330,c6,c6,0)
- GameGFX.large.DrawColoured(KeySym(GameConfig.kleft),500,180,c1,c1,0)
- GameGFX.large.DrawColoured(KeySym(GameConfig.kright),500,210,c2,c2,0)
- GameGFX.large.DrawColoured(KeySym(GameConfig.krotright),500,240,c3,c3,0)
- GameGFX.large.DrawColoured(KeySym(GameConfig.krotleft),500,270,c4,c4,0)
- GameGFX.large.DrawColoured(KeySym(GameConfig.kdrop),500,300,c5,c5,0)
- GameGFX.large.DrawColoured(KeySym(GameConfig.kpause),500,330,c6,c6,0)
+ GameGFX.large.Draw("Left",250,180,c1,c1,0)
+ GameGFX.large.Draw("Right",250,210,c2,c2,0)
+ GameGFX.large.Draw("Rotate Right",250,240,c3,c3,0)
+ GameGFX.large.Draw("Rotate Left",250,270,c4,c4,0)
+ GameGFX.large.Draw("Drop",250,300,c5,c5,0)
+ GameGFX.large.Draw("Pause",250,330,c6,c6,0)
+ GameGFX.large.Draw(KeySym(GameConfig.kleft),500,180,c1,c1,0)
+ GameGFX.large.Draw(KeySym(GameConfig.kright),500,210,c2,c2,0)
+ GameGFX.large.Draw(KeySym(GameConfig.krotright),500,240,c3,c3,0)
+ GameGFX.large.Draw(KeySym(GameConfig.krotleft),500,270,c4,c4,0)
+ GameGFX.large.Draw(KeySym(GameConfig.kdrop),500,300,c5,c5,0)
+ GameGFX.large.Draw(KeySym(GameConfig.kpause),500,330,c6,c6,0)
Local k:Int=-1
@@ -210,7 +211,7 @@ Function Menu()
EndIf
GameGFX.large.Draw("START LEVEL ",tx1,356)
- GameGFX.large.DrawColoured(GameConfig.start_level,tx2,356,255,255,0)
+ GameGFX.large.Draw(GameConfig.start_level,tx2,356,255,255,0)
EndIf
Select sel
@@ -235,10 +236,10 @@ Function Menu()
Rem
SetScale(2,2)
- GameGFX.font.CentreColoured("HARDWIRE",0,255,255,0)
+ GameGFX.font.Centre("HARDWIRE",0,255,255,0)
SetScale(1,1)
- GameGFX.font.CentreColoured("Copyright (c) 2005 Ian C",20,255,0,0)
+ GameGFX.font.Centre("Copyright (c) 2005 Ian C",20,255,0,0)
EndRem
SetColor(255,255,255)
diff --git a/particle.bmx b/particle.bmx
index 6269381..6eba5d3 100644
--- a/particle.bmx
+++ b/particle.bmx
@@ -17,7 +17,7 @@ Type TParticle
Field dy:Double
Field ai:Double
Field s:Double
- Field si:double
+ Field si:Double
Function Dust:TParticle(x:Int, y:Int)
Local o:TParticle=New TParticle
@@ -98,3 +98,106 @@ Type Particles
SetScale(1,1)
End Function
End Type
+
+Type TTextParticle
+ Field txt:String
+ Field x:Double
+ Field y:Double
+ Field a:Double
+ Field dx:Double
+ Field dy:Double
+ Field ai:Double
+ Field s:Double
+ Field si:Double
+ Field r:Int
+ Field g:Int
+ Field b:Int
+ Field fnt:TBitmapFont
+
+ Function Create:TTextParticle(fnt:TBitmapFont, txt:String, x:Double, y:Double, dx:Double, dy:Double, r:Int, g:Int, b:Int, a:Double, ai:Double, s:Double, si:Double)
+ Local o:TTextParticle=New TTextParticle
+
+ If x=-1
+ x=GraphicsWidth()/2
+ EndIf
+
+ o.x=x
+ o.y=y
+ o.a=a
+ o.ai=ai
+ o.dx=dx
+ o.dy=dy
+ o.s=s
+ o.si=si
+ o.txt=txt
+ o.r=r
+ o.g=g
+ o.b=b
+ o.fnt=fnt
+ Return o
+ End Function
+
+ Method Update:Int()
+ SetAlpha(a)
+ SetScale(s,s)
+ fnt.CentreOn(txt,x,y,r,g,b)
+ x:+dx
+ y:+dy
+ a:+ai
+ s:+si
+ Return a>0
+ End Method
+End Type
+
+Type TextParticles
+ Global plist:TList
+ Global sy:Int
+ Const sx:Int=646
+
+ Function Init()
+ plist=CreateList()
+ sy=300
+ End Function
+
+ Function Clear()
+ plist.Clear()
+ sy=300
+ End Function
+
+ Function Big(txt:String, r:Int, g:Int, b:Int)
+ plist.AddLast(TTextParticle.Create(GameGFX.font,txt,-1,GraphicsHeight()-GameGFX.font.MaxHeight()/2,0,0,r,g,b,1,-0.01,1,0))
+ plist.AddLast(TTextParticle.Create(GameGFX.font,txt,-1,GraphicsHeight()-GameGFX.font.MaxHeight()/2,0,0,r,g,b,1,-0.02,1,0.1))
+ End Function
+
+ Function Score(txt:String)
+ Local r:Int=Rand(128,255)
+ Local g:Int=Rand(128,255)
+ Local b:Int=Rand(128,255)
+
+ plist.AddLast(TTextParticle.Create(GameGFX.font,txt,sx,sy,0,0,r,g,b,1,-0.01,1,0))
+ plist.AddLast(TTextParticle.Create(GameGFX.font,txt,sx,sy,0,0,r,g,b,1,-0.02,1,0.1))
+
+ sy:+GameGFX.font.MaxHeight()
+
+ If sy>GraphicsHeight()-20
+ sy=300
+ EndIf
+ End Function
+
+ Function Draw()
+ Local l:TEasyLink=TEasyLink.Create(plist)
+
+ While l.Value()
+ Local p:TTextParticle=TTextParticle(l.Value())
+
+ If (p.Update())
+ l.MoveNext()
+ Else
+ l.Remove()
+ EndIf
+ Wend
+ SetColor(255,255,255)
+ SetAlpha(1)
+ SetScale(1,1)
+ End Function
+End Type
diff --git a/sounds.bmx b/sounds.bmx
index b33ccec..51f37e7 100644
--- a/sounds.bmx
+++ b/sounds.bmx
@@ -14,22 +14,38 @@ Type Sound
Global popsfx:TSound
Global clicksfx:TSound
Global pathsfx:TSound
+
+ Global play_pop:Int
+ Global play_click:Int
+ Global play_path:Int
Function Init()
popsfx=LoadSound("incbin::SFX/pop.wav")
clicksfx=LoadSound("incbin::SFX/click.wav")
pathsfx=LoadSound("incbin::SFX/path.wav")
+ play_pop=False
+ play_click=False
+ play_path=False
End Function
Function Pop()
- popsfx.Play()
+ play_pop=True
End Function
Function Click()
- clicksfx.Play()
+ play_click=True
End Function
Function Path()
- pathsfx.Play()
+ play_path=True
+ End Function
+
+ Function Process()
+ If play_pop Then popsfx.Play()
+ If play_click Then clicksfx.Play()
+ If play_path Then pathsfx.Play()
+ play_pop=False
+ play_click=False
+ play_path=False
End Function
End Type
diff --git a/types.bmx b/types.bmx
index 42cb2bd..0de29d6 100644
--- a/types.bmx
+++ b/types.bmx
@@ -26,7 +26,6 @@ Incbin "GFX/copperslice.png"
Incbin "GFX/dust.png"
Incbin "GFX/title.png"
Incbin "GFX/gameover.png"
-Incbin "GFX/cursor.png"
Incbin "TILES/tile.png"
Incbin "TILES/pit_top.png"
@@ -45,6 +44,9 @@ Incbin "TILES/top_right.png"
Incbin "TILES/bottom_left.png"
Incbin "TILES/bottom_right.png"
+Incbin "TILES/special_bomb.png"
+Incbin "TILES/special_twister.png"
+
Const HERTZ:Int=60
Type Lookup
@@ -83,7 +85,6 @@ Type GameGFX
Global scores_button:TImage
Global keys_button:TImage
- Global cursor:TImage
Global tile:TImage
Global pit_top:TImage
@@ -104,6 +105,9 @@ Type GameGFX
Global bottom_left:Timage
Global bottom_right:Timage
+ Global special_bomb:TImage
+ Global special_twister:TImage
+
Function Init()
font=TBitmapFont.Load("incbin::GFX/font.bmf",0)
small=TBitmapFont.Load("incbin::GFX/small.bmf",0)
@@ -129,7 +133,6 @@ Type GameGFX
right_button=LoadImage("incbin::GFX/right_button.png",0)
tile=LoadImage("incbin::TILES/tile.png",0)
- cursor=LoadImage("incbin::GFX/cursor.png",0)
pit_top=LoadImage("incbin::TILES/pit_top.png",0)
pit_bottom=LoadImage("incbin::TILES/pit_bottom.png",0)
@@ -148,6 +151,9 @@ Type GameGFX
top_right=LoadImage("incbin::TILES/top_right.png",0)
bottom_left=LoadImage("incbin::TILES/bottom_left.png",0)
bottom_right=LoadImage("incbin::TILES/bottom_right.png",0)
+
+ special_bomb=LoadAnimImage("incbin::TILES/special_bomb.png",32,32,0,40)
+ special_twister=LoadAnimImage("incbin::TILES/special_twister.png",32,32,0,40)
End Function
End Type
@@ -199,7 +205,7 @@ Type GameConfig
s.WriteInt(kleft)
s.WriteInt(kright)
s.WriteInt(krotright)
- s.WriteInt(krotright)
+ s.WriteInt(krotleft)
s.WriteInt(kdrop)
s.WriteInt(kpause)
s.WriteInt(start_level)