Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this assignment, we'll be working with PyGame. Before you start, you will have to install PyGame. Each question involves modifying the code in Answer

For this assignment, we'll be working with PyGame. Before you start, you will have to install PyGame.

Each question involves modifying the code in Answer each question in a file called qXX.py where XX is the question number. To make your life easier, start with this zip file.

Unless specified otherwise, these questions are all independent so, for example, your program for Question 3 should not have a background that changes color every second (Question 2).

Submit all your python code and any other files (images, sounds, or fonts) needed to run your code.

Assignment Questions

If you have trouble understanding what any of these questions is asking, see the sample video that is (or will shortly be) posted at the end of this assignment.

The PyGame documentation will be helpful and so will the example that we did in class.

  1. Modify the sample code so that the background color is red.
  2. Modify the sample code so that the background color transitions through the sequence black, red, green, blue, orange, yellow, brown. The background color should change once per second (every 30 frames). You can use this list of colors to figure out the RGB color codes.
  3. Use Google's advanced image search to find a reasonably-sized image that is free to reuse and that includes transparency. Modify the sample code so that it draws your image centered in the middle of the screen.
  4. Modify the sample code so that your image sits in the middle of the screen and rotates at a rate of 2 revolutions per second 1 revolution every 2 seconds. (See pygame.transform.rotate() documentation)
  5. Use Google's advanced image search to find a reasonably-sized image of a ball that is free to reuse and that includes transparency. Modify the sample code so that your ball slides back and forth across the bottom of the screen. It should take 2 seconds for the ball to go from the left side to the right.
  6. Improve your animation for question 5 so that the ball rotates, accurately, as if it were rolling back and forth.
  7. Modify your animation for question 6 so that the ball travels counterclockwise around the edge of the screen
  8. Using the system default font, with a size of 200 100, draw your name centered in the middle of the screen. (See pygame.font.Sysfont() and Font.render()).
  9. Download a free TrueType font (this is a file that ends in .ttf) from somewhere like this site. Using this font, draw your name centered at the top of onthe screen. (See Font() for information on how to create a font from a file.)
  10. Download four .wav sound files from some site like this. Make an application that plays a different one of these four sounds when the user presses one of the 'a', 's', 'd', or 'f' keys.
  11. Make a simple application in which the image of a ball repeatedly moves to some location on-screen that the user has clicked. Each click should play a sound. Each time the ball reaches it's target play a different sound.
  12. (Bonus question.) Write a simulation that simulates balls being fired from the bottom center of the screen at some angle that ranges between 70 and 110 degrees. Some force like Earth's Gravity should act on these balls so that they eventually fall down. Each time the user hits the space bar a new ball is fired.

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: 3

blur-text-image

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

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions