How to make Player sprite move but keep distance from touch point?

0 favourites
  • 4 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • Good day everyone,

    I am trying to make a simple "space shooter" game, and look for a way to add standard touch controls, so that when I move my finger across the phone screen my plane ("Player" sprite) moves accordingly.

    I found a good example in Vertical space shooter template (from within Construct 3 - "browse examples")

    It works ok, only, the plane on the screen comes right under my finger every time, so it gets covered and I cannot see it and it's not very convenient. How to keep the plane stay on certain distance away, preferably so that it's slightly above my finger all the time (I guess most similar games now use this pattern)?

    Thanks!!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here is a simple way to drag a sprite at distance. Add two instance variables on the sprite - dx and dy and these events:

    You can also try a virtual "thumbstick" control:

    howtoconstructdemos.com/category/virtual-joystick

  • dop2000

    Thanks a lot!!!

    Tried both. Virtual Joystick looks great but was bit complicated for me, or maybe I just chose a hard sample. I am new to Construct and coding in general.

    Anyway the first (yours) example seems to be enough.

    Only one confirmation: how do I make Player move faster than my finger? Player is not very responsive now. For example to make Player cross from the screen's left border to right I have to move my finger kind of more than the screen width. And I would like it to be opposite, so Player moves more.

    Which parameter is responsible for that? Or do I have to set another one.

  • Here is an even simpler method with just one event. Change 1.5 value to make it move faster or slower:

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