Make a “bouncing rectangle!”
For this, please use the given screen and rectangle width and height.
The rectangle should start in (or close to) the middle of the screen. It should be moving down and right. If it collides with the screen’s lower or upper boundary, it should reverse its vertical direction. If it collides with the screen’s left or right boundary, it should reverse its horizontal direction.
Note: you can import the time module as well and use
time.sleep(0.01)in your mainloop to act as a frame cap to make your rectangle more visible
This problem builds off of bouncingrect.py
Add some text to the screen. You can either:
- draw the text to a specified coordinate OR
- blit the text onto the bouncing rectangle.
This problem is a continuation of Bouncing Rect.
Reset Position Outline:
- Reset the moving rectangle's position if it leaves the screen at speed of 5px down and 5px right per frame
- Then, if the bottom of the rectangle is greater than the screen height or the bottom of the rectangle is greater than the screen height or the bottom of the rectangle is greater than the screen height or the