Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+5 votes

I'm trying to do the last question on the sample test, which is the graphics question. I got the circle to move up by using a while loop, and I used the checkMouse() method to click somewhere on the screen so that it could go back down. When I click it goes down for a split second. But the moment I release the click, it continues to go up. How do I make my circle continue to go down until it is completely off of the window?

asked in CSC201 Spring 2021 by (2.7k points)

1 Answer

+4 votes

This is happening because you haven't checked until the checkMouse is not equals to none. If you do this, once you click the widow, the ball will move down. Just putting the check mouse, will only allow to click but not interrupt the previous movement.
Hope that helps :)!

answered by (6k points)
+2

Oh yeah that clears it up a bit. I just turn in the sample question and the hint said that I need to use getMouse() for the first click and checkMouse() for the second click. How would you suggest setting up the loops? I'm still a little confused.

+4

Okay,
1. first you would have a window.getMouse()
2. you would have while True: meaning if the user clicks on the mouse,
3. move the circle up,
4. under the while loop, set the window.checkMouse() to a variable, because when running, it is checking outside the loop first.
5. then have while is not equals to None:
move the circle down,

Tip: don't forget to add the time to pause under both while loops

Hope this makes it clearer!

+1

I was able to move the circle up but not sure how to set up the while loop to have the circle go down.

...