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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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