class_name Goal extends Area3D # A goal is a dumb sensor: it detects the ball crossing its plane and emits # goal_scored. The game mode owns all consequences (score, resets). Two of # these live in each arena, one per team. # The team that concedes when the ball enters this goal. @export var team: int = 0 signal goal_scored(team: int) func _ready(): # Group lets AI controllers and game modes discover goals add_to_group("goal") func _on_body_entered(body): if body.is_in_group("ball"): goal_scored.emit(team)