Set sprite to mouse position?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ComLarsic

I want to set a Sprite2D node to the position of the mouse,
i tried doing:

Position = GetLocalMousePosition();

but it keeps flickering and it isn’t and moves at mouse movement but isn’t at the same position.

how would i do this?

:bust_in_silhouette: Reply From: rakkarage
func _physics_process(_delta: float) -> void:
	_sprite.global_position = get_global_mouse_position()