How do I Move left and right on touch

Get help using Construct 2

Post » Tue Aug 19, 2014 7:17 pm

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.
B
10
S
4
G
3
Posts: 176
Reputation: 2,539

Post » Tue Aug 19, 2014 8:04 pm

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.
Capture.PNG


It is done using the custom movement behavior.

I hope that helps and good luck with your project.
You do not have the required permissions to view the files attached to this post.
B
40
S
12
G
11
Posts: 331
Reputation: 7,752

Post » Tue Aug 19, 2014 8:33 pm

Hi @FragFather!

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.
B
10
S
4
G
3
Posts: 176
Reputation: 2,539

Post » Tue Aug 19, 2014 8:50 pm

@Allardje

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

ClampTapLeftRightMove.capx


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.
You do not have the required permissions to view the files attached to this post.
Find all the Construct 2 games that were on Steam Greenlight here
B
36
S
10
G
7
Posts: 475
Reputation: 7,015

Post » Tue Aug 19, 2014 9:01 pm

@OddConfection

That worked like a charm!

Thanks alot!
B
10
S
4
G
3
Posts: 176
Reputation: 2,539

Post » Tue Aug 19, 2014 9:51 pm

move to tap.png
You do not have the required permissions to view the files attached to this post.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Tue Aug 19, 2014 10:24 pm

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 :(!
B
10
S
4
G
3
Posts: 176
Reputation: 2,539


Return to How do I....?

Who is online

Users browsing this forum: matriax and 7 guests