extends CharacterBody2D const SPEED = 3.0 func _ready() -> void: var crystals = get_tree().get_nodes_in_group("crystals") for crystal in crystals: crystal.connect("_picked_up", Callable(self, "collect")) func collect(): print("something") func _physics_process(delta: float) -> void: # Get the input direction and handle the movement/deceleration. # As good practice, you should replace UI actions with custom gameplay actions. var direction := Input.get_vector("moveLeft", "moveRight", "moveUp", "moveDown") move_and_collide(direction * SPEED)