Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HAS TO BE IN PYTHON. For this assignment, you will start with your solution for the bouncing ball lab to implement a simple pong game

HAS TO BE IN PYTHON.

For this assignment, you will start with your solution for the bouncing ball lab to implement a simple pong game with interface as shown in the following figure.

image text in transcribed

Add a label at the top with the same width as the canvas to show the number of lives left until the game is over. The width of the label is the same as the canvas' width. Notice that the width attribute sets a label's width in characters. Using a negative value sets the width in pixels. The diagram above uses a Verdana 20pt font but you may use any font that is different from tkinter's default font.

Draw a paddle at the center of the canvas' bottom edge as shown in the above diagram. The paddle's width and height are 80 and 20 pixels, respectively. Whenever the user presses the left arrow button, the paddle moves 5 pixels to the left. Likewise, when the user presses the right arrow bottom, the paddle moves 5 pixels to the right. The paddle never moves beyond the right or left edges of the canvas.

The user wants to use the paddle to catch the ball so that it does not hit the bottom wall. Every time the ball hits the bottom wall, the player loses a life and the number of lives left is updated on the label. The game will end when number of lives left is 0. When the game ends, move the ball to its initial position near the top left corner of the canvas. Start the game with 5 lives. Every time the ball hits the paddle, it will bounce off the top of the paddle. Notice that a collision between the paddle and the ball occurs when any part of the ball hits the top surface of the paddle. Sample screen shots are shown below.

image text in transcribed

image text in transcribed

Pong Game Lives left: 5 Pong Game Lives left: 5

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_2

Step: 3

blur-text-image_3

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

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions