Move Sprite - click on scene

Hi All,

I am new to GDevelop and although used some game engines and programming languages I am still getting use to the layout and interface.

My main question here, which I search around with little success, is how do I make a character or sprite move to the location where I have clicked in the scene and keeping the sprites animation correct during its path to where it is heading,

Thank you

Tim

Try the “Add a force to move towards a position” action, and use MouseX() and MouseY() as the position to move towards.

image

Aside from what has been suggested by BWPanda you can have a look at this page to understand how to move sprites: How to move objects in your game [GDevelop wiki]

If you are just starting out it is anyway recommendable to make one or two of the tutorial projects GDevelop 5 tutorials [GDevelop wiki] just to understand how the engine works.

There is also a page full of starters and examples which also include the logic that you need for having the right animation for your sprite Game examples and templates made with GDevelop | GDevelop

@tcs , there are 2 main ways :

  1. If there are obstacles in the way that should be avoided, look into the PathFinding behaviour.
  2. If it’s a straight line to the mouse click, then look into the Tween behaviour, and use the positional tween action.

Using a force towards the mouse position won’t stop it at the click position.