How do I Move left and right on touch

0 favourites
  • 7 posts
From the Asset Store
This is a code so you can see the same skin on all screens (peers). Each peer gets a skin, in addition to 4 directions t
  • Hi all,

    I feel really stupid for this question that i can not fix it.

    I have a object in the middle of the screen. I want to move it to the touched postion.

    Once on that position stop.

    Thats it. Somehow i can't fix it xD..!

    It is a must that the object does not rotate it's angle. It really is as simple as moving left or moving right in a straight line and stopping at the position touched.

  • No need to feel stupid for not being able to figure something out. It takes time to learn Construct.

    Here is a screen shot that should give you everything you need.

    [attachment=0:2p4nxkm0][/attachment:2p4nxkm0]

    It is done using the custom movement behavior.

    I hope that helps and good luck with your project.

  • Hi !

    Thanks for your reply,

    I forgot to mention one thing. Is has to be on a single tap. Not if it is touching.

    So your idea works i got that working to before but it really is "on tap".

    Sorry for not mentioning it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Allardje

    Here's an example using clamp, lerp and a couple of instance variables.

    [attachment=0:3h6dgzb6][/attachment:3h6dgzb6]

    On touch start, it sets Sprite.Destination to Touch.X

    If the Destination is to the left, the Sprite moves to the left until it reaches the place you tapped.

    If the Destination is to the right, the Sprite moves to the right until it reaches the place you tapped.

  • OddConfection

    That worked like a charm!

    Thanks alot!

  • [attachment=0:1l9z9m6p][/attachment:1l9z9m6p]

  • Hi all thanks for your solution, i got it working with OddConfection's method.

    Yet i got a little small question, is it possible to make a sine behavior smooth?

    I got a sine behavior on my char but it moves in almost like steps. Goes smooth to the left, back to center, waits a few milliseconds, smooth to right, smooth to center etc.

    Any idea how i can get this in a flow? Vertical is working smooth but horizontal isn't !

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