Your assignment is to complete our Pong game by placing and managing the remaining UI components for scoring and messaging, adding the missing steps from our state outline, and customizing the game with your own personal touches.
There are five required parts to this, and two that are optional. Completing the required will get you to a B (or B+ if everything is functioning perfectly), and the other two can be added on for an A- or A grade.
HOMEWORK ITEMS
- Customized Sounds – [REQUIRED]
Replace the current paddle, side wall, and back wall sounds with new sounds that you create or find. - Score UI –[REQUIRED]
Add text elements to the Canvas that display the current score, and that update when a scoring event occurs. - Game Over State – [REQUIRED]
The game should end when one player scores 3 points. At this point, gameplay stops and a new round does NOT begin. Make the Message Overlay text object visible and display a “Game Over” message. - “Oops State” – [REQUIRED]
Add a new state to handle the moment when a score first occurs. The ball should remain in position against the wall where it hit while the sound plays, and the Message Overlay should indicate which player scored, or has just won the game. This pause should last approx 2 seconds before moving on to the next step, either restarting the round, or moving to the Game Over state. Make sure to include a new “state” in your enumeration for this point in the flow. - Randomize Direction – [REQUIRED]:
Rather than have the ball fire the same way every time, randomize the direction that the ball is shot. Make sure that the random choice does NOT include directions which would make the game unplayable (such as straight up and down). You can randomize between a small set of options, or you can choose any point within a range, just make sure that the gameplay makes sense and the ball starts by regularly heading towards one of the two player sides. For more information on generating random numbers, take a look at Unity’s Scripting API for Random.Range. (Just make sure you declare “float” values rather than “integers”…) - Press “R” to Restart – [OPTIONAL]
Add a condition to the “game over” state where pressing the “R” key will re-start the game. You will need to re-initialize some of the variables (such as score) to do this. Consider making a function that that will initialize the game values, rather than setting them in the Start( ) function. - 3 – 2 – 1 – GO – [OPTIONAL]
Replace the “Get Ready” message with a countdown message that blinks sequentially “3” then “2” then “1” then “GO!”. Include a countdown beep for each number, and a separate sound for the “go” indicator.
Grading will be handled as follows:
All Required Items (Steps 1-5) : B
All Required Items (Steps 1-5, and everything runs perfectly) : B+
All Required PLUS Item 6 OR Item 7: A
All Required PLUS Item 6 AND Item 7: A+
The project is due by end of day Tuesday (5/30 @ 11:59 pm). Create a compressed (zipped) folder of your project directory**, and submit that in a folder labeled “Assignment 2” that you will create inside your individual assignment folder.
**the file format MUST be *.zip. I will not accept, TAR, GZIP or similar formats.