touch time

Get help using Construct 2

Post » Sat May 03, 2014 12:47 pm

Might someone help me I would like to create a special effect if a certain object is touched for 2 seconds I have looked at all the conditions for touch and have no idea how to do it
Thank you
B
5
S
1
Posts: 21
Reputation: 579

Post » Sat May 03, 2014 5:18 pm

1) Create a global variable. Lets name it "TouchTime" (without the quotes)
2) Create an event and add the "Is in touch" condition
3) Create an action and choose "system", "Add to" and select the "TouchTime" variable.
4) On the "Value" field, input "60 *dt" (without the quotes)
5) Create an other event an add the "Compare variable" condition (under system).
6) Set the comparison for the "TouchTime" variable to be grater or equal to 120.

You are ready to create your action.

You need to reset the "TouchTime" variable every time you lift your finger though. Create an other event:

1) Put the "on any touch end" condition.
2) As an action choose the "set value" (under system) and input "0" (without the quotes)

Done! :)
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Sat May 03, 2014 7:12 pm

Thanks mate it works like a charm iv been struggling with this, thank you so much much appreciated
B
5
S
1
Posts: 21
Reputation: 579

Post » Sat May 03, 2014 8:12 pm

You are welcome!
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 7 guests