Need help with math

0 favourites
  • 5 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hi guys. I need help with some math. I want to change the value of a variable in increments starting at 0 and ending in 100 in a time of 2 seconds. I want the increments to be small, I'm not looking to add 50 to the variable every second. Can someone help me with the math to make that happen? Unfortunately math is not my strong suit. Thank you.

  • myvariable

    System > Every 2 seconds > add 2 myvariable

    subevent ________ >(x)myvariable < 0 > System Subtract 3 from myvariable

    x is for inverted. Every 2 seconds ( if the myvariable is not less than or equal to 0) , subtract 3 from myvariable

    There's a probably a few ways to make this better or implement differently but, depends on your use. Hope this helps or gets you in the right direction.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I was very tired last night when I posted my question so let me try to clarify what I need. I'm working with percentages so technically I need to get from 0 to 1 in increments of 0.01, 0.02, etc until I get to 1. I need to reach 1 in 2 seconds.

    So what I need to figure out is this:

    If variable is less than 1, Every X seconds (x seconds is what I need solved) add 0.01 to variable. In 2 seconds time the variable should reach 1.

  • X=0.005...?

  • Wow, I must have been more tired then I thought last night. Even I should have been able to figure that out! Thank you very much.

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