How can I use continuous Touch to move a Sprite?

0 favourites
  • 7 posts
From the Asset Store
Surena Touch
$2.50 USD
A wrap from official Touch plugin to export touch/mouse input to other plugins.
  • I would like my player sprite to always be located exactly where the user is touching the screen. No delay. Instant movement to the user's touch. Instantly follow the user's finger as it slides across the screen.

    With the Mouse object this works when moving the mouse - by using Mouse -> Cursor is over Background. My sprite follows the mouse cursor exactly.

    With the Touch object I can't seem to get this to work. I have tried:

      Touch -> Is in touch Touch -> Is touching Background Touch -> On any touch start Touch -> On any touch end

    All of these seem to result in the sprite moving to my finger when I place it on the screen - but it doesn't track me if I keep my finger on the screen and slide it around. I have to lift my finger off the screen, and place it down on the screen again to move to a new location.

    What Touch conditions or similar approach can I use so that the user does not ever have to lift their finger from the screen while playing the game?

    Thanks!

  • works for me on android.

  • I'm trying myself, i don't get it. I see your screenshot, but. i am trying to set it so, a user touches/or keeps touching object and it. switches direction and keep the character in continuous movement.

  • Aphixe the solution above is to teleport your character to wherever you tap/touch. If you want the character to move continuously, you will need something like:

    Touch | Is in touch

    System | distance(Player.X, Player.Y, Touch.X, Touch.Y) > 300*dt

    Then:

    Player | Move 300*dt pixels at angle angle(Player.X, Player.Y, Touch.X, Touch.Y)

  • Why not drag n drop?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can also use:

    Is in touch:

    • set Player.Angle to touch.X, touch.Y
    • move (x) Pixel forward
  • Why not drag n drop?

    Nah.It won't work.OP want to teleport it to where he touches.

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