GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Please help my problem.

JaeKhanJaeKhan Posts: 33Member, PRO

Hi, I have a problem whilst I'm making a game..
I used Timer behavior for my score attribute.

Every 0.1 seconds, Score = Score + 0.1

But the problem is, it works well at the beginning but later, it shows up like
66.666666666 or 78.99999999999

and I really want this to be fixed..
I will very appreciate with any helps!
Thank you for reading this post.

Comments

  • jonmulcahyjonmulcahy Posts: 10,380Member, Sous Chef
    edited September 2014

    I would change it to every 0.1 seconds, score = score +1. then when displaying the score, display score/10

    or use the roundto function to round it to 1 decimal point.

  • JaeKhanJaeKhan Posts: 33Member, PRO

    @jonmulcahy said:
    I would change it to every 0.1 seconds, score = score +1. then when displaying the score, display score/10

    or use the roundto function to round it to 1 decimal point.

    I have never used roundto function and I do not know what it exactly is nor how it works..

    can you please give me a clear example how to use roundto function?

  • JaeKhanJaeKhan Posts: 33Member, PRO

    @jonmulcahy said:
    I would change it to every 0.1 seconds, score = score +1. then when displaying the score, display score/10

    or use the roundto function to round it to 1 decimal point.

    by the way, thank you very much for your help! I tried your first solution and it works perfectly.. very thanks!

Sign In or Register to comment.