Connect the StaticBody
signal input_event
(or of the Area
if you want a different shape otherwise you don't need a Area
) to a script:
func _on_StaticBody_input_event(camera, event, click_position, click_normal, shape_idx):
if event is InputEventMouseButton and event.pressed:
var static_body = $StaticBody
static_body.get_parent().remove_child(static_body)
$Player.add_child(static_body)
# optionally adjust the position