Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Pong game is a classical board game that includes a ball and a paddle. In our case, we can have multiple balls, i.e. three, and

Pong game is a classical board game that includes a ball and a paddle. In our case, we can have multiple balls, i.e. three, and a set of bubbles at the top of the window. The aim of the game is to keep the balls moving above the paddle at all times and to explode all the bubbles. Balls can be kept in the game using the paddle, by moving paddle left and right to avoid losing balls to the ground. We provide a simple PongGame.py file as a starter template that includes the necessary codes for window initialization and draws the paddle and a ball (Fig. 1a). You can make any changes you want on the template. You are allowed to use graphics, math and random modules to complete this homework. Other libraries, e.g., tkinter etc., are not allowed. Specification details: 1. When you run the code, the first screen will look like Figure 1a. You must make the necessary changes to make it look like Figure 1b. You can use any colors you want. Figure 1. (a) The initial screen of the template code PongGame.py (b) Desired initial screen. 2. The Ball class, defined in the PongGame.py, allows the user to create a ball at a given point, with a given color, radius, x direction, and speed. In the template code, we created a predefined number of balls, as a list, by setting each ball a random color, a random x direction and random speed for you. 3. The number of balls will be determined by the global BALL_COUNT variable in the template code, e.g., 1, 3, 5 etc. as in the following figure. 4. When the s key is pressed, balls start moving. They move randomly to the right or left at a 45 degree angle. When the k key is pressed, all the balls get slower. When the l key is pressed, the balls get faster. Minimum and maximum speed limits were determined for the balls and provided to you in the template code. You can change this part during the development phase; yet, make sure that before submission you reset these values to the initial limits. 5. If a ball hits to the boundaries of the window, i.e. left, right, upper bounds, or to the paddle; it will bounce off and keep on its movement. When a ball hits the ground, you lose a life (check 8 for additional details). When a ball hits the bubble, the corresponding bubble should be exploded and the ball continues motion uninfluenced, until it hits the top of the window as in the following figure. 6. The Paddle class, defined in the PongGame.py, allows the user to create the paddle at a given coordinate, with a given width, height, and color. When a key is pressed, the paddle moves to left, d key is pressed, it moves to right. The left-right movements are defined in the template code. However, you must control the paddles movement if it exceeds the window. 7. You must write the Bubbles class to define bubbles shown in the top of the window. You must design this class by yourself. 8. In the beginning, the player has 2 lives. When one of the balls falls to the ground, 1 life is lost in the game and the game returns to the starting point. The Live section is updated on starting point screen as follows: 9. The game is over when all the lives are lost or all the bubbles explode. When the game is over, you should delete all the bubbles, balls, and paddle. The game over screen will be implemented as follows: 10. When the game is over, pressing any key closes the window. 11. The GUI name should include your student id. So, you should write your student id where it is written StudentId Pong Game in the figures. Development & Testing: We recommend using Ubuntu in the assignment development process. You do not need to use input and output files in this assignment. > python3 PongGame.p

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

300 Studentld Pong Game Studentid Pong Game 60 130 Lives - 2 Lives 600 30 100 25 b) Lives Lives GAME OVER GAME OVER YOU LOSTI Press Ang Kes to Quit YOU MINI Press Ary Reigi ta Quit D Studenti Dong Game Lives

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions