Write a program to animate a circle bouncing around a window

Assignment Help Basic Computer Science
Reference no: EM131302300

Modify the face class from the previous problem to include a move method similar to other graphics objects. Using the move method, create a program that makes a face bounce around in a window (see Programming Exercise 17 from Chapter 7). Bonus: have the face change expression each time it "hits" the edge of the window.

Exercise 17:

Write a program to animate a circle bouncing around a window. The basic idea is to start the circle somewhere in the interior of the window. Use variables dx and dy (both initialized to 1) to control the movement of the circle. Use a large counted loop (say 10000 iterations), and each time through the loop move the circle using dx and dy. When the x-value of the center of the circle gets too high (it hits the edge), change dx to -1. When it gets too low, change dx back to 1. Use a similar approach for dy.
Note: Your animation will probably run too fast. You can slow it down by using the sleep function from the time library module.
from time import sleep
...
sleep(0.005) # pauses the program for 5 thousandths of a second.

Reference no: EM131302300

Questions Cloud

Describe tools the fed can use to affect the money supply : Economics for International Affairs Fall 2016 Assignment. Describe two tools the Fed can use to affect the money supply, other than open market operations. Describe the three roles played by money
How much is the stock currently worth : Netscrate Communications does not currently pay a dividend. You expect the company to begin paying a $4.2 per share dividend in 13 years, and you expect dividends to grow perpetually at 5.2 percent per year thereafter. If the discount rate is 16 perc..
Market value of the house mortgage : A person has a net asset of $1 million, including a $300,000 net equity of a house (market value of the house – mortgage). Specifically, the house has a market value of $600,000 including $400,000 for the structure and $200,000 for the land, and a mo..
Explain the disciplinary action and corrective action : Explain the difference between Disciplinary Action and Corrective Action. What are the benefits and pitfalls of each?Does your company have a succession planning program? If so describe it and its effectiveness.
Write a program to animate a circle bouncing around a window : Modify the face class from the previous problem to include a move method similar to other graphics objects. Using the move method, create a program that makes a face bounce around in a window (see Programming Exercise 17 from Chapter 7). Bonus: ha..
What is the most you would pay per share : The dividend for Should I, Inc., is currently $1.25 per share. It is expected to grow at 20 percent next year and then decline linearly to a 5 percent perpetual rate beginning in four years. If you require a 15 percent return on the stock, what is th..
Identified style of leadership appropriate : Identify the style of leadership this nurse manager is using. Support your choice with evidence from the scenario and the assigned readings. Is the identified style of leadership appropriate in this situation?
What is option for ben from strictly financial standpoint : Ben Bates graduated from college six years ago with a finance undergraduate degree. Although he is satisfied with his current job, his goal is to become an investment banker. He feels that an MBA degree would allow him to achieve this goal. Assuming ..
Modify the baum welch algorithm given : Modify the Baum-Welch algorithm given in Appendix A (c15 bwa.m) so that one does not have to enter initial guesses for the matrices A, B, and π.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Network-based recommender systems

Nowadays, like magic, there are social network-based recommender systems, proximity location-based application and a handful of other models and features. Seeking a recommendation (for anything) these days is only a click away!

  Analogies describe complex subjects in a more meaningful

Analogies describe complex subjects in a more meaningful and understandable way. This CheckPoint provides an opportunity for you to describe principles of radio wave transmission using original analogies. Consider the following example analogies:A co..

  Find out how smtp hosts deal with unknown commands

You can either read the RFC or contact an SMTP server as in Exercise 14 and test its responses to nonexistent commands.

  Description of what the computer considers

For your initial post, provide your own description of what the computer considers "TRUE" and what the computer considers "FALSE." Then, provide at least two code examples (original examples) that would return TRUE, and provide a description of what ..

  Ensure security, integrity, and operability of the database.

Select one of the steps you perform in the physical design of this database. Analyze how this step helps ensure security, integrity, and operability of the database.

  Splits the word into a unicode character array

These tasks entail developing a single program that contains methods of the following tasks. Your program may run either on the command-line or as an applet. Write methods that take a word input by the user (10%) and then: (10%) splits the word int..

  Explaining downtick in project success rates of it projects

What is the likely reason or reasons for the downtick in project success rates of IT projects and what recommendations would you make to improve the success rates? Be specific.

  Evaluate which method would be efficient for planning

Evaluate which method would be efficient for planning proactive concurrency control methods

  How much time is required to teach a large network

Why do we speak about "discovering knowledge" of self-learning networks instead of "teaching" them?

  Would that be a live acquisition, or a postmortem one

Consider a local area network, attached to the Internet, with email capabilities provided to LAN users. What are some of the capabilities already built in to these systems that might aid the investigator? How might you put those to use? Would that be..

  Create a script that presents a movie guessing game

Use a single script file named Week5.php to display and process the form Can this be done with the movies 8 mile and black swan.

  Find the net work output per unit mass of air

Consider an ideal Stirling cycle using air as the working fluid. Air is at 400 K and 200 kPa at the beginning of the isothermal compression process, and heat is supplied to air from a source at 1800 K in the amount of 750 kJ/kg.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd