Touch and Release

Get help using Construct 2

Post » Sun Mar 01, 2015 9:43 pm

I'm trying to do the following with touch.

On touch of X button, a sprite would start it's animation, but when I released, the animation would stop (at current screen). I can get the on TOUCH/HOLD process done, but I'm not seeing how to do the release. Any suggestions? thanks as always.
B
9
S
2
Posts: 104
Reputation: 1,098

Post » Sun Mar 01, 2015 9:46 pm

Create an action: "Is touching X button". Then mark it and press X on your keyboard to invert it. Or right click the action and choose invert. The action will then be: "Is NOT touching X button"
B
11
S
4
G
2
Posts: 116
Reputation: 1,936

Post » Sun Mar 01, 2015 10:14 pm

@detteMan, I know what you're suggesting, but somehow it's not working. This is getting the animation to start, but it's not stopping ( just loops)
You do not have the required permissions to view the files attached to this post.
B
9
S
2
Posts: 104
Reputation: 1,098

Post » Sun Mar 01, 2015 10:16 pm

You have to take the not touch outside of the touch trigger event. Right now it's a sub event of if touch is true. And the not touch event doesn't have code to stop the animation unless you removed it before you took the screenshot.
B
23
S
4
G
2
Posts: 364
Reputation: 2,392

Post » Sun Mar 01, 2015 10:42 pm

hmm.. I can't move the invert. Maybe I am not understanding it right.
B
9
S
2
Posts: 104
Reputation: 1,098

Post » Sun Mar 01, 2015 10:56 pm

not exactly what I wanted, but this is the idea. I wanted the user to touch a btn.
You do not have the required permissions to view the files attached to this post.
B
9
S
2
Posts: 104
Reputation: 1,098

Post » Sun Mar 01, 2015 11:44 pm

Not at my computer but you should be able invert the 'Is touching object' event cause that might be what you need to see if their not touching your button.
Last edited by PhoenixNightly on Sun Mar 01, 2015 11:52 pm, edited 1 time in total.
B
23
S
4
G
2
Posts: 364
Reputation: 2,392

Post » Sun Mar 01, 2015 11:46 pm

Also instead of checking just for touch start you should see if they actually touching your button with 'On touched object' to trigger the animation. Cause right now they touch anywhere would trigger the event to play the animation.

**Edit**
Actually you first screen shot is almost there except instead you have an invert "is in touch" which should instead be "is not touching Sprite" and not be a subevent
B
23
S
4
G
2
Posts: 364
Reputation: 2,392

Post » Mon Mar 02, 2015 12:52 am

Okay, im not at my computer either. But if i understand correctly what you are trying to do this is what you should do.
Event 1
Condition: is touching Sprite
Action: Set animation speed to 1

Event 2
Condition: is touching Sprite (invert)
Action: Set animation speed to 0

Im typing from phone so sorry for the sloppyness
B
11
S
4
G
2
Posts: 116
Reputation: 1,936

Post » Mon Mar 02, 2015 12:54 am

Make sure you choose the Condition "is touching object". Not "On touched object"
B
11
S
4
G
2
Posts: 116
Reputation: 1,936

Next

Return to How do I....?

Who is online

Users browsing this forum: marcoscodas and 11 guests