Please help my problem.

JaeKhanJaeKhan Member, PRO Posts: 33

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 Member, Sous Chef Posts: 10,408
    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 Member, PRO Posts: 33

    @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 Member, PRO Posts: 33

    @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.