[Solved]How do I - Math - How do I do Percentages?

1 favourites
  • 3 posts
From the Asset Store
Aliens are invading our planet! Solve the math question, and attack the alien with your laser. Covers addition, subtract
  • Hello community, I am bad at math!

    I remember from when I was in school, it was something something 100 over a number? Haha, that's irrelevant right now...

    Basically, uh. How do I type into string percentages?

    How do I get the system to evaluate a number and give me the closest percent to that, and then of course "round" up or down?

    I'm reading https://www.scirra.com/manual/126/system-expressions and also viewtopic.php?t=72716&start=0 as I wait for one of you lovely people to save me from my ineptitude of all things math.

    Final question, what is the difference between the "Beginner's Questions" and "How do I" forum?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Percent means "per one hundred" so it is value/possible then * 100. So if you have 5 apples out of a possible 7, that's 5/7*100 = 71.4%

    In C2 you can use the 'round' expression to round to the nearest integer (whole number). so round(5/7*100) would give you 71. If you want it to have the % symbol, just use &

    So:

    On Action---Set Text to round(5/7*100) & "%"

    Will set the text of a text object to 71%.

    Also, How Do I is generally (to me) for more in-depth questions whereas Beginnger's Questions is simpler questions for people starting out with C2.

  • Woah. Thank you kindly C-7 , I got my answer in another post, but this one definitely helped me understand it deeper.

    And thanks for answering my difference between question.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)