Question: Create a Display that is 5 0 0 x 5 0 0 . Create a Rect that is 5 0 x 5 0 , placing

Create a Display that is 500x500. Create a Rect that is 50x50, placing it at the center of the Display. Blit to the Display a blue Surface at the Rects coordinates and with the Rects dimensions.
Read from the Event Queue, taking the following actions:
If the user presses w, move the Rect up 5.
If the user presses s, move the Rect down 5.
If the user presses d, move the Rect 5 to the right.
If the user presses a, move the Rect 5 to the left.
If the user presses r, place the Rect back at the center of the Display.
Do not allow the user to go offscreen. In the example above, you can see at the bottom right which key is being pressed. You do not need to include what key is being pressed to your Display. It is only present here for demonstration purposes.

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 Programming Questions!