Touch and Release

0 favourites
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • 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.

  • 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"

  • 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 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.

  • hmm.. I can't move the invert. Maybe I am not understanding it right.

  • not exactly what I wanted, but this is the idea. I wanted the user to touch a btn.

  • 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.

  • 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

  • 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

  • Make sure you choose the Condition "is touching object". Not "On touched object"

  • I suggested "on touched" cause once it's set to 1 you don't have to set it again. "on is touching" would keep running every tick which isn't necessary. From what he explain he need it to switch set the animation speed to 1 when the button is touch which what "on touched object" will do. The animation doesn't change again until they stop touching. On is touching will keep running as long as it is true and keep setting the speed to 1 even when it already is one.

    To stop the inverted event from running every tick add a secondary check to see if the animation is even running should be done. So if they are not touching and the animation frame isn't 0 do this.

  • I suggested "on touched" cause once it's set to 1 you don't have to set it again. "on is touching" would keep running every tick which isn't necessary. From what he explain he need it to switch set the animation speed to 1 when the button is touch which what "on touched object" will do. The animation doesn't change again until they stop touching. On is touching will keep running as long as it is true and keep setting the speed to 1 even when it already is one.

    To stop the inverted event from running every tick add a secondary check to see if the animation is even running should be done. So if they are not touching and the animation frame isn't 0 do this.

    Of course! I was thinking to fast. Thanks for the correction.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Awesome you all. Thanks for all the help.

  • got it. thanks all. Learned a few things on the way there as well. awesome.

  • Trying to take this further. If I am flipping through different frames, when I stop ( release) wondering if I can do .. if frame = x, do this? I tried to do it with setting 1 when it hit frame 2 ( for example) but I'm wanting to do it on the release. any thoughts on this DetteMan PhoenixNightly

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)