Need help with math

Get help using Construct 2

Post » Thu Nov 24, 2016 6:03 am

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.
B
61
S
20
G
56
Posts: 1,077
Reputation: 35,986

Post » Thu Nov 24, 2016 8:28 am

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.
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,283

Post » Thu Nov 24, 2016 4:11 pm

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.
B
61
S
20
G
56
Posts: 1,077
Reputation: 35,986

Post » Thu Nov 24, 2016 4:28 pm

X=0.005...?
B
23
S
11
G
6
Posts: 181
Reputation: 5,003

Post » Thu Nov 24, 2016 5:23 pm

@megalocrator 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.
B
61
S
20
G
56
Posts: 1,077
Reputation: 35,986


Return to How do I....?

Who is online

Users browsing this forum: ametueraspirant, dand, mickclarke and 28 guests