Assignment-1, Pong
Assignment-1, Pong
Software Development
Winter 2024
ASSIGNMENT-1
SCHOOL OF COMPUTER SCIENCE TOTAL MARKS: 20
DEADLINE: FEB 29
LAND ACKNOWLEDGEMENT
The School of Computer Science at the University of Windsor sits on the Traditional Territory of the Three Fires Confederacy
of First Nations. We acknowledge that this is the beginning of our journey to understanding the Significance of the history of
the Peoples of the Ojibway, the Odawa, and the Pottawatomie.
Description
In this assignment, you need to develop a game, called Pong, using Java Swing and Java 2d APIs
you learned in the classes. Pong is a table-tennis themed two-player arcade game. Each player
controls a paddle (there are two paddles) and the paddle is used to hit a ball to the opponent. If a
player misses the ball, the other player gets a point. The player who gains 10 points wins the
game. You can play a free version of the game on this website: https://www.ponggame.org/.
More information about the game can be found here: https://en.wikipedia.org/wiki/Pong
Required Functionalities
• The game needs to be played by two persons. There should be two paddles. One paddle
should be controlled by W (Up) and S (Down). Other paddle should be controlled by up
and down arrow keys.
• At the beginning of the game, the ball should be in the middle and can travel in any
direction at a reasonable speed. The speed can be set by the players.
• If the ball hits a wall, it should be bounce off the wall at the same speed. The same happens
if the ball hits a paddle. It is up to you how you want to determine the angle of the bounce
off (i.e., at which direction and angle you want to reflect the ball). I suggest you play the
game to finalize your decision. You can consider the location of the paddle where the
intersection with the ball occurs and the angle of incidence to determine the angle of
reflection. You can also consider the speed of the paddle to determine the speed of
reflection but this is not required. We assume a constant speed for the ball.
• A sound should be played when the ball hits by a paddle or by the wall. A simple approach
would be playing the beep sound.
• At certain interval, the game throws a special kind of balls in both directions (either blue
or red in color). They will not be reflected, instead consume when hit by a paddle. If a
player consumes a blue ball, the paddle size will be increased by a small amount.
Consuming the red ball will decrease the size of the paddle. There should be a minimum
and maximum length of the paddle (make a reasonable decision). Be creative when
implementing this functionality.
• The game should display the current scores of both players. The game starts with the initial
score of zero. When a player obtains 10 points (i.e., wins the game), the game should show
the winner with the final score.
• You should provide options to start, restart and quite the game. Use menu(s) for this
purpose.
Marking Scheme
• Add a menu/menu item(s) to start/restart/quit the game and the menu is functional .
(0.5+2 = 2.5 Marks)
• Add a menu/menu item(s) to set the speed of the game and the menu is functional.
(0.5+2 = 2.5 Marks)
• Implement the paddles and players can control the paddles (1+1 = 2 Marks).
• The balls behave as expected (i.e., start from the middle, reflects by wall or paddles at an
angle) (5 Marks)
• Implement the feature involving special balls (red and blue color) (4 Marks)
• The game update/show scores of both players and determine the winner (1 Marks).
• The game is playable, and the quality of the presentation is good (3 Marks).
Submission
• Complete your implementation.
• Upload the program on the course website. For each assignment, you will find a folder
(Assignment-X, X represents the assignment number) in the assignment section of the
website.
• If you have only one Java file to submit, upload only that file. If you have created
multiple files, compress the project folder (zip compression) you created and upload the
zip file.
• Rename the file/folder as follows: LastName_FirstName_A_LabExerciseNumber
(Example: Asaduzzaman_Muhammad_A_1.Java or
Asaduzzaman_Muhammad_A_1.zip).
• Include a plain text file with explanations (such as note.txt) if there are any additional
requirements to run your program.