Activate Touch Events

Get help using Construct 2

Post » Wed Dec 05, 2012 2:30 am

I have a group of events that "activate" when an object is touched.

Say I want to activate those events without actually touching the object, how would I go about that?
B
19
S
3
G
2
Posts: 212
Reputation: 4,011

Post » Wed Dec 05, 2012 8:34 am

Well if your using the beta for C2 then


--onTouch of Object
-> call foo function


--on some other condition
-> call foo function


--foo function
-> do stuff

------------------------------------
If your using the last stable build
var action = 0

--onTouch of Object
-> action = 1

--on some other condition
-> action = 1


--condition: compare action = 1
-> do stuff



Personally I like functions. They make like easier and they are less condition checks in the main loop :)
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Wed Dec 05, 2012 8:48 am

[QUOTE=jayderyu]
--condition: compare action = 1
-> action = 1
-> do stuff
[/QUOTE]

If you want the actions to only happen once, be sure to modify the value of action so that every tick action is NOT equal 1 and the group of events/actions does not execute every tick.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Wed Dec 05, 2012 1:24 pm

Got it. Thanks guys.
B
19
S
3
G
2
Posts: 212
Reputation: 4,011

Post » Wed Dec 05, 2012 8:45 pm

oops. that's right. be sure to flag it once it executes :D
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834


Return to How do I....?

Who is online

Users browsing this forum: MrLOL64 and 21 guests