check variables within a time frame

Get help using Construct 2

Post » Fri Apr 21, 2017 9:21 pm

I have a variable and when it loses a specific amount within a specific time I want to do something.

How do I check 'Variable loses X within X seconds'?
B
8
S
1
Posts: 16
Reputation: 814

Post » Fri Apr 21, 2017 9:28 pm

You could have an array, and whenever the variable has its' value changed, you could push the amount it changed as well as the current time to the array. Like array.at(x,0) would be the time, and array.at(x,1) would be the amount it was changed.
Also in the same event (when the value is changed and array is modified), you can do a check to see if it has changed enough within a certain period by looping through the array(starting from end), until it goes past the period you want, and add up all the value changes while it loops. If the value it greater than what you want, then you can do whatever you want now and clear the array.
B
48
S
23
G
66
Posts: 1,144
Reputation: 39,059

Post » Mon Apr 24, 2017 5:02 pm

Thank you for the reply. I will look into this.
B
8
S
1
Posts: 16
Reputation: 814


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 26 guests