Real Attribute Question.

CaptFinnCaptFinn Member Posts: 1,828
edited February 2016 in Working with GS (Mac)

Real Attribute: FuelCellPercent 100
Boolean Attribute: FuelCellDraining false

Display actor: Display text "Fuel Cell"..(game.FuelCellPercent)..%

Rule:
When FuelCellDraining is true

Wrapped in a Every 1 sec Timer
change FuelCellPercent to FuelCellpercent-.25

Ok Before I start the scene. The Display Actor Display the following Fuel Cell 100%

When im using fuel. it changes 100%-99.75%-99.5%-99.25%-99%-98.75%-98.5% and so on.

What I want is for it to always show 100.00%-99.75%-99.50%-99.25%-99.00%-98.75% and so on.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    That's what padReal(game.FuelCellPercent,2,2) is for.

    From the Cookbook:

    padReal (Function): Displays a floating point with padding and precision.

    For instance, padReal(9.1234,15,6) will display 9.1234 with at least 15 total digits (including the decimal) and at most 6 digits to the right of the decimal. – 00000009.123400.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • CaptFinnCaptFinn Member Posts: 1,828

    Thanks @tatiang. As soon as you responded. I foiund something on prec(game.fuelused),2)

Sign In or Register to comment.