Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Making a ball fall in PYTHON 3, PYTHON HELP I dont understand how im supposed to get the ball to continuously fall, and how to

Making a ball fall in PYTHON 3, PYTHON HELP

I dont understand how im supposed to get the ball to continuously fall, and how to make it move when i click in it? I only get it to move every time I click

The problem is this and the code I have already is underneath it image text in transcribedfrom graphics import * def q2a(): win = GraphWin("window",400,400) win.setCoords(0,0,400,400) win.setBackground("light grey") #drawing circle circle = Circle(Point(200,100),30) circle.setFill("red") circle.draw(win) #text message = Text(Point(200,200),"Click Anywhere to Begin") message.draw(win) #clicking while True: click = win.checkMouse() if click: message.undraw() dy=1 dx = 0 dy *=-9 circle.move(dx,dy) q2a()

Question 2a: Write a function named q2a) that creates a simple game where the user tries to keep a red Circle object from falling down to the bottom of a window based on the following parameters: The game is drawn in a 400 x 400-pixel Graphics window with a light grey background A Circle, (filled with red), is drawn in the Graphics window with a radius of 30 and center coordinates:x -200, y-100 Text object containing "Click Anywhere to Begin" centered in the Graphics window Once a mouse click is detected anywhere in the Graphics window, the Text object is removed and using a loop the Circle is animated and starts to fall' and accelerate straight towards the bottom of the window as if affected by gravity. If a mouse click is detected inside the radius of the Circle object: Set the dx movement of the Circle to the difference between the x coordinate of the Circle and the x coordinate mouse click Set the dy movement to -1.1 times the absolute value of the difference between the y coordinate of the Circle and Y coordinate the mouse click o o If the Circle reaches the bottom of the window, the game is over When the game is over, a Text object containing "Game Over - Click to Close" appears centered in the window and the function waits for a mouse click before closing the Graphics window and ending

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

More Books

Students also viewed these Databases questions