Here's an example of a script you'd attach to a node that's a child of your sprite which, as long as the node is clickable should move around your sprite.
extends Control # could be any node with the on_gui_input signal
var can_drag := true # set this yourself with other code if you like
var is_dragging := false
func _on_gui_input(event: InputEvent) -> void:
if event is InputEventMouseButton:
is_dragging = event.pressed
if event is InputEventMouseMotion and can_drag:
var length : float = event.relative.length()
if is_dragging and length < 180.0:
var n : Node2D = get_parent()
var movement : Vector2 = event.relative.rotated(n.rotation)
movement.x *= n.scale.x
movement.y *= n.scale.y
n.global_position += movement
Dragging and dropping is typically not so simple if you're expecting the objects to have some behavior such as snap to grid.