summaryrefslogtreecommitdiff
path: root/game.bmx
diff options
context:
space:
mode:
Diffstat (limited to 'game.bmx')
-rw-r--r--game.bmx41
1 files changed, 37 insertions, 4 deletions
diff --git a/game.bmx b/game.bmx
index c11fbc3..8908235 100644
--- a/game.bmx
+++ b/game.bmx
@@ -32,6 +32,7 @@ Type TGame
Field coli:Int
Field final_percent:Int
+ Field pass_time:Int
Function Create:TGame(level:TLevel)
Local o:TGame=New TGame
@@ -45,11 +46,12 @@ Type TGame
o.done=LEVEL_NOTOVER
o.frame=0
o.placed=0
- o.txtoff=[GameGFX.font.TextWidth("PARTICLES"),GameGFX.font.TextWidth("CAPTURED"),GameGFX.font.TextWidth("TIMER")]
+ o.txtoff=[GameGFX.font.TextWidth("PARTICLES"),GameGFX.font.TextWidth("CAPTURED"),GameGFX.font.TextWidth("TIMER"),GameGFX.font.TextWidth("LEFT")]
o.playing=False
o.col=0
o.coli=5
o.final_percent=0
+ o.pass_time=0
Return o
End Function
@@ -71,7 +73,11 @@ Type TGame
GameGFX.font.CentreColoured("Need "+level.winpercent+"% to clear",y,col/2,col,col)
y:+yi
- GameGFX.font.CentreColoured("You can place "+level.maxmass+" masses",y,col/2,col,col)
+ If level.maxmass>1
+ GameGFX.font.CentreColoured("You can place only "+level.maxmass+" masses",y,col/2,col,col)
+ Else
+ GameGFX.font.CentreColoured("You can place only 1 mass",y,col/2,col,col)
+ EndIf
y:+yi
If level.invmass
@@ -148,6 +154,10 @@ Type TGame
percent=final_percent
Else
percent:Int=Int(Float(captured)/Float(num)*100.0)
+
+ If percent>=level.winpercent And pass_time=0
+ pass_time=timer
+ EndIf
EndIf
If (timer=0 Or num=captured+lost) And done=LEVEL_NOTOVER
@@ -170,6 +180,14 @@ Type TGame
GameGFX.font.DrawColoured(percent+"%",txtoff[1]+210,0,50,255,50)
EndIf
+ GameGFX.font.Draw("LEFT",400,0)
+
+ SetScale(2,2)
+ For Local f:Int=0 Until level.maxmass-placed
+ DrawImage(GameGFX.mass,410+txtoff[3]+f*10,4)
+ Next
+ SetScale(1,1)
+
GameGFX.font.Draw("TIMER",600,0)
If timer>10
@@ -201,13 +219,28 @@ Type TGame
EndIf
EndIf
Case LEVEL_WON
+ If final_percent=100
+ SetScale(4,4)
+ GameGFX.font.CentreColoured("PERFECT!",50,col,255-col,col/2)
+ col:+coli
+
+ If col=255 Or col=0
+ coli=-coli
+ EndIf
+ EndIf
+
SetScale(2,2)
- GameGFX.font.CentreColoured("LEVEL COMPLETED!",GraphicsHeight()/2,255,255,0)
+ SetAlpha(0.7)
+ GameGFX.font.CentreColoured("LEVEL COMPLETED!",GraphicsHeight()/2+20,255,255,0)
+ GameGFX.font.CentreColoured("You got the pass mark with "+pass_time+" left on the clock",GraphicsHeight()/2+40,255,255,0)
SetScale(1,1)
+ SetAlpha(1)
Case LEVEL_LOST
SetScale(2,2)
- GameGFX.font.CentreColoured("LEVEL FAILED!",GraphicsHeight()/2,255,64,64)
+ SetAlpha(0.7)
+ GameGFX.font.CentreColoured("LEVEL FAILED!",GraphicsHeight()/2+20,255,64,64)
SetScale(1,1)
+ SetAlpha(1)
EndSelect
Return done