Hi, I’m building a user placement system which I’m very new to and I’m trying to build a system to delete tiles. Right now when I click anywhere on the screen, the last node that was placed gets deleted but I want to delete a specific node where my mouse position is.
Code
elif(currentBuildMode == buildingModes[2]):
get_global_mouse_position()
for node in get_tree().get_nodes_in_group(“Crops”):
if node.is_in_group(“Crops”):
node.queue_free()
break
The section above is the deletion part of the user placement system.
I’ve tried adding another if statement such as if node.position == get_global_mouse_position()but that just breaks the deletion system and nothing happens. My theory is get_all_nodes_in_group just gets every single node in that group and it doesn’t run since not all nodes are under your mouse position I may be wrong on that.
Below is a screen recording showing what happens