From 7ff4818c925a84230b5f5386fd90198f6419044a Mon Sep 17 00:00:00 2001 From: Ian C Date: Sun, 2 Oct 2005 02:08:48 +0000 Subject: Added initial Menu code. --- game.bmx | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 3 deletions(-) (limited to 'game.bmx') diff --git a/game.bmx b/game.bmx index 6c30f84..3556409 100644 --- a/game.bmx +++ b/game.bmx @@ -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 x1 - 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 -- cgit v1.2.3