Touch controlled Topdown character move : stucked!

Hello everyone

I would like to be able to indicate a direction to a character on a mobile with a touch of the finger. I’ve tried draggable objects and draggable physics object, but the result is more like a catapult. I’ve tried in mouse touch events and in move character to cursor x and y action: I get more the sensation of a vector applied (necessarily with applied force) to a spaceship/boat in the wind than to a walking character.
I don’t want to use virtual buttons to simulate the up/down/right/left keys in classic TopDown behavior, I just want to place my index finger close to the character to make it move and then stop once the pressure is released.
What should I do?
Thanks for your help.
GS

Translated with DeepL Translate: The world's most accurate translator (free version)strong text

You could use the pathfinder behavior. When the mouse/touch is pressed move the object with the pathfider move to a position CursorX(), CursorY() Add a trigger once.

If you want the object to stop moving when the touch/mouse is released then you could use mouse/touch is released, pathfinder move to position and use the object’s X(),Y() (or CenterX() and CenterY() ) for the destination.

There isn’t a cancel or stop action for the pathfinder. So, the easiest thing to do is have it move to the current position.

https://wiki.gdevelop.io/gdevelop5/behaviors/pathfinding/

Well thanks a lot! I’ll try today your solution.
GS

1 Like