class_name Item extends Node3D ## Base class for item pick-ups in the world. signal on_collect(player: WorldPlayer) @onready var explosion_player: AnimationPlayer = %ExplosionPlayer func collect(player: WorldPlayer) -> void: # Note that this animation will call `queue_free` in 5 seconds! explosion_player.play("explode") _collect(player) on_collect.emit(player) func _collect(_player: WorldPlayer) -> void: pass # Defined in derived type func _on_collection_area_body_entered(body: Node3D) -> void: if body is GameBall: var ball: GameBall = body if ball.player: collect(ball.player)