summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2005-12-17 00:20:47 +0000
committerIan C <ianc@noddybox.co.uk>2005-12-17 00:20:47 +0000
commit0129dc56ba73e43f148b779d9ff549f286e66f1d (patch)
treefe48d488b70a2ffed88908e6bb0fdbfd74bd19a2
parentd3edb4bcc6f0a173e21ea3f323eb594e4615afdc (diff)
Improved collapsing of spaces in game map
-rw-r--r--gametypes.bmx51
-rw-r--r--hardwire.bmx14
2 files changed, 40 insertions, 25 deletions
diff --git a/gametypes.bmx b/gametypes.bmx
index 772b9e3..24d1617 100644
--- a/gametypes.bmx
+++ b/gametypes.bmx
@@ -839,36 +839,41 @@ Type TGameMap
special=s
End Method
- 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
+ Method DropColumn(x:Int, y:Int)
+ While y>0
+ map[x,y]=map[x,y-1]
+ y:-1
+ Wend
+ map[x,0]=Null
+ End Method
+
+ Method AnyAbove:Int(x:Int, y:Int)
+ While y>=0
+ If map[x,y]
+ Return True
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
+ y:-1
+ Wend
- Return diff
+ Return False
End Method
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()
+ Local y:Int=Pit.HEIGHT-1
+ Local drop:Int=False
+
+ While y>0 And AnyAbove(x,y)
+ If map[x,y]
+ If drop
+ Particles.AddDust(Pit.X(x)+16,Pit.Y(y)+32)
+ EndIf
+ drop=False
+ y:-1
+ Else
+ DropColumn(x,y)
EndIf
- Next
+ Wend
Next
End Method
diff --git a/hardwire.bmx b/hardwire.bmx
index 75a6a02..f1f8997 100644
--- a/hardwire.bmx
+++ b/hardwire.bmx
@@ -138,6 +138,8 @@ Function Menu()
Local col:Int=128
Local coli=1
+ TextParticles.Clear()
+
While Not done
Cls
SetColor(col,col,255)
@@ -231,13 +233,15 @@ Function Menu()
quit=True
EndIf
+ TextParticles.Draw()
+
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)
+ GameGFX.large.CentreOn(last_score,200,520,255,col,0)
+ GameGFX.large.CentreOn(GameConfig.hiscore,600,520,255,col,0)
EndIf
Select sel
@@ -287,6 +291,8 @@ Function Menu()
Flip
Wend
+ TextParticles.Clear()
+
TFadeScreen.DoFadeOut()
End Function
@@ -312,6 +318,10 @@ Function DebugCode()
While Not done
Cls
+ If gm.overflow
+ GameGFX.large.Centre("OVERFLOW!",0)
+ EndIf
+
gm.Draw()
p.Draw()