5 minutes
Right now, you can dribble the ball into the net and nothing happens. No point. No reset. No score. The goal line is only paint on the grass.
Four components fix that: Goal, Score, BallReset, and Scoreboard. They all listen for one event. None of them ever calls another. When the ball crosses the line, a goal fires. The score goes up, the ball moves back to centre, and the HUD updates.
Add the goals, the score, and the HUD
Each net gets a Goal. A Goal is an invisible trigger box. Its ownerEntity is the team that scores into it. Add a Score entity to hold the tally. Add a Board for the scoreboard. Add a BallReset to the ball:
The ownerEntity swap is on purpose. A ball in the red net scores for Blue. So RedNet's owner is Blue. That one string sends the point to the right team.
Continue reading
Unlock the Full Course
Every lesson, the runnable examples, and the finished build — yours to keep.