One click\touch game

how do I make my character go from side to side with only one click at a time?

You want a platform character to move to the clicked x-axis?
Or do you want to move the character a fixed distance?

fixed distance.
the game is for android mobile.

you have some option here, you can use forces, or position changes, or simulate key pressed with timers, or tweens.
you should check if player is moving, and if not, you check the position of mouse/touch and compare it to the position of the player. if x is less, move left, if x is more, move right.
i think tween is the easiest to use.

keep in mind, with tweens, it will move thru walls and everything, so you have to remove the tween, when in collusion with an impassible wall.

If your level is not straight, it might be better to use timers and simulate key pressed, so that the platform behaviour manages the height differences.

1 Like

I have tryng to do what you suggested with no success.
The problem is that the only thing that actually going to work is tween behavior.
And I always stuck in the same place.
The first jump work fine.
And then nothing…pla

%D7%9C%D7%9C%D7%90%20%D7%A9%D7%9D yer only jumps with no direction.

dont do both.
you ether use tweens, or you use platformer behavior .
if you use platformer behavior, you also need to simulate a direction key, if you dont want to jump just straight up.

like in the screenshot i showed before, you need to use the x position of your mouse as condition to determine in which direction you want to jump.
i recommend to also check the y position of mouse, if you plan on moving with the mouse without jumping too.

I thought about that, but the problem is that I want the player to touch anywhere he wants on the scree. Kind like floppy bird.

if you just want to jump left and right alternated you can do this:

You can also use tweens instead of simulate controls in the same way.

this will be left/right alternating ONLY

Thanks I will try that.

this is how it could look like, with tweens

I just try that thanks man its working.
One last question.
How do I make the player keep flipping horizontally with every jump?

by adding the action …

you might need to change yes / no, depending what the original orientation of your sprite is

Thank you very much I will try that.