> For the complete documentation index, see [llms.txt](https://kree.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kree.gitbook.io/documentation/code-snippets/follow-mouse-on-click.md).

# Follow Mouse On Click

```java
public class SceneNameHere extends Scene {

    private GameObject player = new GameObject(this, "Player");
    private Vector2 target = new Vector2(0, 0);

    public Scene(Game game) {
        super(game);
    }

    @Override
    public void Initialize() {
        player.setPosition(new Vector2(128, 128));
        player.setScale(new Vector2(16, 16));
    }

    @Override
    public void Update() {
        if(Input.mouseClicked)
            target = Input.getMouse();
        player.transform.position.moveTowards(target);
    }

    @Override
    public void Render(Graphics g) {

    }

}
```
