Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 8 A: Create a Pygame Display that is 4 0 0 4 0 0 . Create a Rect that is 5 0 4 0

Lab8A: Create a Pygame Display that is 400400. Create a Rect
that is 50400 and place it along the center of the Display, blitting to
the Display a red Surface at the Rect's coordinates.
Create a Rect that is 5050 and place its left border at the center of
the left border of the Display. Blit to the Display a blue Surface at
the Rect's coordinates.
Move the blue Rect from the left to the right of the Display at a speed
of 5, and then back again from the right to the left. Repeat this cycle
until the user closes the program.
Using colliderect(), change the red Surface to green whenever
the two Rects are colliding, and change it back to red when the
two Rects are not colliding.
Lab8B: Expand on Lab8A by having two more Rects with associated blue
Surfaces, one which bounces along the bottom border of the Display at a speed
of 20, and one which bounces along the top border at a speed of 10.
Using collidelist() or collideall(), change the red Surface's color to green
whenever ANY of the other three blue Surfaces' Rects collide with the red
Surface's Rect. Change the Surface color back to red if no collision is
occurring.
Lab8C: Create a Display that is 500500. Create a Rect that
is 5050, placing it at the center of the Display. Blit to the
Display a blue Surface at the Rect's coordinates and with the
Rect's 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
image text in transcribed

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_2

Step: 3

blur-text-image_step3

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

Question

2.11 What are the components of a budget?

Answered: 1 week ago

Question

Can you see what limitations your purpose imposes on your strategy?

Answered: 1 week ago