Question: Crazy Pong design using Python 3 Game Description: Ball bounces off the top, bottom and right edge of the screen and the paddle. A new

Crazy Pong design using Python 3

Game Description: Ball bounces off the top, bottom and right edge of the screen and the paddle. A new ball is added each time the paddle hits another ball. Each ball is randomly positioned inside the buffer zone of the screen and is given random speed between a minimum and maximum value. If the ball gets by the paddle the game is over.

Game Design: Fill in the blanks.

class Ball(games.Sprite):

"""

A bouncing ball.

"""

image - image object for ball

MIN_SPEED integer for minimum speed

MAX_SPEED integer for maximum speed

BUFFER integer for distance from screen boundaries when created

def __init__(self):

""" Initialize Ball object. """

def update(self):

""" Deal with beyond left edge, or hitting top or bottom. """

def bounce(self, paddle_right):

""" Bounce off paddle. """

def end_game(self):

""" End the game. """

class Paddle(games.Sprite):

"""

A paddle controlled by mouse that balls can bounce off.

"""

image image object for paddle

def __init__(self):

""" Initialize Paddle object. """

def update(self):

""" Move to mouse y-position. """

def check_hit(self):

""" Check for balls hitting paddle. """

def main():

""" Play the game. """

load and set background image

create paddle sprite and add to screen

create first ball sprite and add to screen

set mouse pointer to invisible

grab all input to game screen

start game loop

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!