Making drag and drop 2D physics, similar to games like little inferno

Godot Version

4.3

Question

So i’ve been chipping away at a project that involves 2D physics and a drag and drop system, similar to something like little inferno. I put something together, but it feels a bit janky and not exactly what I want.

This video below, is basically exactly what I want to achieve, from a game jam game awhile back called “Pit of Babel”

As you can see the blocks don’t have physics until placed, and there’s no issues with accidentally picking up multiple objects (which is what im struggling with rn), what are some tips you guys would suggest?

This is the current code I have for my physics object

extends RigidBody2D
var mouseentered = false



# Called when the node enters the scene tree for the first time.
func _ready():
	pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _physics_process(delta):
	if Events.mouseclicked and mouseentered:
		linear_velocity= ( get_global_mouse_position () - global_position ) * 50


func _input(event):
	if event is InputEventMouseButton:
		if event.button_index == MOUSE_BUTTON_LEFT:
			if event.is_pressed() and mouseentered:
				Events.mouseclicked = true
			else:
				Events.mouseclicked = false

func _on_area_2d_mouse_entered():
	mouseentered = true

func _on_area_2d_mouse_exited():
	mouseentered = false