How do I measure time between two events?

Get help using Construct 2

Post » Thu May 04, 2017 11:04 pm

Hi everyone! I'm new to C2 and I find it very interesting
However, I have a problem with time: How to measure between two events? In more detail, I want to measure time between repetitions of collision
Thanks so much for any response!
B
5
Posts: 3
Reputation: 231

Post » Fri May 05, 2017 4:06 am

You'll need a counter variable, and a state variable (Boolean instance variable would be good).

On collision with object and statevariable is false, set statevariable to true, and set countervariable to 0.

The next event should have the conditions system else, on collision with object, and statevariable is true, then set statevariable to false.

In the last event event, if state variable is true, set counterrvariable to countervariable+dt.

The time elapsed between your collisions will be available as countervariable.
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Google [Bot], part12studios and 8 guests