Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help I am trying to make a game called Pong which is very famous, I have practically created the ball and both paddle

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
I need help I am trying to make a game called Pong which is very famous, I have practically created the ball and both paddle in code ... I have problems making the ball move constantly and bounce off the walls and on the paddle and on create a score .... according to the instructions I cannot use another library other than graphics.py .... and it shows me an error message ... here is my python code:
1 fron graphics import * PongGame.py > w N def paddleA_up(paddleA): paddleA.move(0, -20) 6 def paddleA_down (paddleA) : paddleA.move(0, 20) 7 8 def paddleB_up(paddleB): paddleB.move(0, -20) def paddleB_down (paddleB) : paddleB.move(@, 20) 9 10 11 12 13 14 15 16 17 18 19 20 21 def main(): #Window win = GraphWin("Pong Game", 600, 400) win.setBackground("black") #Paddles paddleA = Rectangle(Point(5,1), Point(10, 70)) paddlea.setOutline("white") paddlea.setFill(white) paddles.draw(vin) paddlea.move(5, 170) #PaddleB paddles = Rectangle(Point(5,1), Point(10, 1)) paddles.setOutline("white") paddles. setFill("white") paddles.draulvin) paddles.move(580, 170) #Ball ball = Circle(Point(20, 20), 8) ball.setOutline("white") ball.setFill("white") ball.draw(win) ball.move(290, 170) PongGame.p Dail.araw(win) ball.move(290, 170) dx = 1 dy = 1 #Move Paddle while True: key = win.checkKey() if key "o": 4break elif key "Up": paddleA_up(paddleA) elif key == "Down": paddleA_down{paddleA) elif key = "w": paddleB_up(paddles) elif key == "s": paddleB_down{paddleB) #Move Ball for i in range (10000): ball.move() if ball.move() > 20: dx = -1 = elif ball.move() 20: dy = -1 elif ball.move() 20: TypeError: '>' not supported between instances of 'NoneType' and 'int' Johnatans-MBP-3:- johnatanortiz$ /usr/local/bin/python3 /Users/Johnatanortiz/Desktop/PongGame Traceback (most recent call last) File "/users/Johnatanortiz/Desktop/PongGame.py", line 94, in module main() File "/Users/johnatanortiz/Desktop/PongGame.py", line 68, in main ball.move() TypeError: move() missing 2 required positional arguments: 'dx' and 'dy' zohnatans-HBP-3: johnatanortiz$ I Ln 70, Cal 25

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

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions

Question

Explain the meaning and importance of nonverbal messages.

Answered: 1 week ago

Question

1. Identify the sources for this conflict.

Answered: 1 week ago

Question

3. The group answers the questions.

Answered: 1 week ago