Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab 9 : Implement the program in the picture to the right. A video has also been provided showing how this program is supposed to
Lab: Implement the program in the picture to the right. A video has
also been provided showing how this program is supposed to work
while in action. Note the following:
General Info:
The screen's size is
Files:
The images needed are provided.
The sound files needed are provided.
Images:
All images files are either or
You must scale the images down to x before
using them as buttons.
The laser image's center is at the exact center of the screen.
Both the on and the off button are aligned horizontally with the laser button.
The on button's right border is pixels away from the laser button's left border.
The off button's left border is pixels away from the laser button's right border.
Button Font:
This refers to all the Font objects rendered under the buttons.
All of these Font objects use the default Pygame font, and are size
All of these font Surfaces are vertically aligned with their respective buttons.
All of these font Surfaces' top border are pixels down from their respective button's
bottom border.
Status Font
This refers to the Font object right above the laser button.
This Font object uses the default Pygame font, and is size
This font's Surface is vertically aligned with the center of the screen.
This font's Surface center is pixels above the center of the screen.
Sounds:
Only one sound can be playing at a time.
Functionality:
While the laser is "Off", the Shoot and Power Down button do nothing.
Upon pressing the Power Up button, play the power up sound and change the status to
"Charging".
When the power up sound finishes playing, change the status to "Ready".
While the laser is "Ready", the Power Up button does nothing.
While the laser is "Ready", pressing the Shoot button plays the shoot sound and changes
the status to "Shooting".
When the shooting sound is done playing, change the status back to "Ready".
While the laser is "Ready", pressing the Power Down button plays the power down sound
and changes the status to "Discharging".
When the power down sound finishes playing, change the status to "Off".
While the laser is "Charging", "Discharging", or "Shooting", none of the buttons do anything.
Hint: You should use a couple of extra Boolean variables to keep track of when the laser is charged and
when the laser is busy doing something.
CODE IN PYTHON PLEASE
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started