diff options
Diffstat (limited to 'game.bmx')
-rw-r--r-- | game.bmx | 64 |
1 files changed, 61 insertions, 3 deletions
@@ -52,9 +52,54 @@ Type TGame o.coli=5 o.final_percent=0 o.pass_time=0 + + TParticleMachine.Clear() + Return o End Function + Method LabelMass(m:TMass) + Local x:Int=m.x + Local y:Int=m.y + Local tx:Int + Local lx:Int + Local ty:Int + Local ly:Int + Local s:String + Local l:Int + + If m.inverse + s="-"+Int(m.mass)+" NEWTONS" + Else + s=Int(m.mass)+" NEWTONS" + EndIf + + If m.friend + s="COLLECTOR: " + s + Else + s="MASS: " + s + EndIf + + l=GameGFX.smallfont.TextWidth(s) + + ly=y + ty=Max(0,Min(GraphicsHeight()-GameGFX.smallfont.MaxHeight(),y-3)) + + If x<GraphicsWidth()/2 + tx=0 + lx=l+2 + x:-4 + Else + tx=GraphicsWidth()-GameGFX.smallfont.TextWidth(s) + lx=tx-3 + x:+4 + EndIf + + SetColor(255,col,col) + DrawLine(x,y,lx,ly) + GameGFX.smallfont.DrawColoured(s,tx,ty+2,255,col,col) + End Method + Method Intro() Local y:Int=GraphicsHeight()/4 Local yi:Int=25 @@ -65,6 +110,10 @@ Type TGame coli=-coli EndIf + For Local m:TMass=EachIn mass + LabelMass(m) + Next + SetScale(2,2) GameGFX.font.CentreColoured(level.name,y,col,col,255-col) @@ -74,9 +123,9 @@ Type TGame y:+yi If level.maxmass>1 - GameGFX.font.CentreColoured("You can place only "+level.maxmass+" masses",y,col/2,col,col) + GameGFX.font.CentreColoured("You can place only "+level.maxmass+" masses of " + Int(level.placemass) + " Newtons",y,col/2,col,col) Else - GameGFX.font.CentreColoured("You can place only 1 mass",y,col/2,col,col) + GameGFX.font.CentreColoured("You can place only 1 mass of " + Int(level.placemass) + " Newtons",y,col/2,col,col) EndIf y:+yi @@ -158,6 +207,13 @@ Type TGame If percent>=level.winpercent And pass_time=0 pass_time=timer EndIf + + Local lostpercent:Int=Int(Double(lost)/Double(num)*100.0) + + If lostpercent>(101-level.winpercent) + done=LEVEL_LOST + final_percent=percent + EndIf EndIf If (timer=0 Or num=captured+lost) And done=LEVEL_NOTOVER @@ -183,8 +239,9 @@ Type TGame GameGFX.font.Draw("LEFT",400,0) SetScale(2,2) + SetColor(255,255,255) For Local f:Int=0 Until level.maxmass-placed - DrawImage(GameGFX.mass,410+txtoff[3]+f*10,4) + DrawImage(GameGFX.mass,410+txtoff[3]+f*10,3) Next SetScale(1,1) @@ -225,6 +282,7 @@ Type TGame col:+coli If col=255 Or col=0 + TParticleMachine.AddFirework(Rand(0,GraphicsWidth()),Rand(0,GraphicsHeight())) coli=-coli EndIf EndIf |