2019-05-31 17:57:18 +00:00
|
|
|
---
|
|
|
|
title: "Scoring"
|
|
|
|
date: 2019-05-30T16:08:54-07:00
|
|
|
|
weight: 1000
|
|
|
|
---
|
|
|
|
|
2019-06-03 20:11:53 +00:00
|
|
|
Now we're getting into the meat of the game.
|
2019-05-31 17:57:18 +00:00
|
|
|
|
2019-06-03 20:11:53 +00:00
|
|
|
In Pong, your opponent scores a point by getting the ball behind your paddle. There's a few things we need to sort out here.
|
2019-05-31 17:57:18 +00:00
|
|
|
|
2019-06-03 20:11:53 +00:00
|
|
|
- The ball needs to detect collision with the goals.
|
|
|
|
- The ball needs to disappear for a while when a goal is scored.
|
|
|
|
- The ball position and velocity needs to be reset on a "serve".
|
|
|
|
- The score of each player needs to be tracked.
|
2019-05-31 17:57:18 +00:00
|
|
|
|
2019-06-03 20:11:53 +00:00
|
|
|
Here's what I'm thinking: first let's sort out collision detection with the goal and resetting the ball. Then we can set up a scoring mechanism.
|