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

  Rsa protocol to encrypt and decrypt messages

In this problem you are enquired to hand-turn RSA protocol to encrypt and decrypt messages by using rather smaller numbers than are used in practice, so that calculations can be done by hand.

  Advantages and features of the bus system

Describe an activity that you engage in that involves features similar to those of a synchronous bus system and one that involves features similar to those of an asynchronous bus system. Explain in each case how the advantages and features of the ..

  Performance appraisal and promes

Based on what you know about performance appraisal and ProMES, what are the most important features of the ProMES system? Indicate how SRU's current ProMES system does or does not abide by these important features.

  Better software tool internet explorer or mozilla firefox

There are several Internet browsers available today, and many people select which to use without giving it consideration. Explain which is better software tool: Internet Explorer, Mozilla Firefox, or Google Chrome?

  Migrating business-critical applications

Migrating business-critical applications

  What is the output of the following loop

What is the output of the following loop

  Write a c program using the fork() system

Write a C program using the fork() system call that generates this sequence in the child process. The starting number will be provided from the command line. For example, if 8 is passed as a parameter on the command line, the child process will ou..

  Define artificial intelligence

Define Artificial Intelligence. Discuss the goals of Artificial Intelligence.

  Discuss some options for mobile wireless

Please discuss some options for mobile wireless internet connection, and describe the types of hardware that would be involved in making such a connection

  Attributes represent in an er model

Describe what attributes represent in an ER model and provide examples of simple, composite, single-value, multi-value, and derived attributes?

  Proposal for health information systems driving by ehealth

Proposal for health information systems driving by ehealth

  Determine throughput for file transfer form one host-another

Assume Host A wishes to send the large file to Host B. Suppose no other traffic in network, Determine the throughput for the file transfer?

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