mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-10 16:04:04 +00:00
22 lines
524 B
GDScript
22 lines
524 B
GDScript
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)
|