I tried to replicate the code in kidscancode.org with Sprites. However, I haven't being able to invoke the drop function there. I've just separated the pickup and drop with a call to yield(), which not very useful.
I am not able to invoke the input-event function.
Other thing is that I am not able to see all the 3 Sprites (which are child nodes of World) during runtime. Only, one shows up during runtime. The Sprites are not instances, though. Is that the problem? Here is the code of my World and Ball script:
var held = true
global_transform.origin = get_global_mouse_position()
held = false
func _input_event(viewport, event, shape_idx):
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
var held_object = null
for node in get_tree().get_nodes_in_group("pickable"):
node.connect("clicked", self, "_on_pickable_clicked")
held_object = object
if event is InputEventMouseButton and event.button_index == BUTTON_LEFT:
if held_object and !event.pressed:
held_object = null