Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92056940

Have any Question?


Related Questions in Computer Engineering

Question you company provides wireless networking services

Question: You company provides wireless networking services. One of your customers complains about the downloading performance being poor. After investigation, you find that the customer's 802.11 wireless network is inte ...

Assignment week 3 create a scrum boardprojects that conform

Assignment: Week 3 Create a Scrum Board Projects that conform to the Agile methodology often use something called a scrum board. You can think of a scrum board as a digital whiteboard containing yellow "stickies," each l ...

Qion leadership paradox and inter-team relationsa

Question: Leadership Paradox and Inter-team Relations A. What is the leadership paradox? Give some reasons why a leader can encounter difficulty in newly formed teams or groups using a participative management system. Su ...

Sorting program note make sure you use c programming

Sorting Program Note: Make sure you use c++ programming otherwise i will not grade your work For this assignment, you are to write a comparative algorithm that will compare the efficiency of three sorting routines. Here ...

Answer the following question a suppose you have two

Answer the following Question : (a) Suppose you have two initially empty queues Q1 and Q2. Explain how you could implement the stack ADT using Q1 and Q2. Your answer should provide pseudocode algorithms for the stack ope ...

Technology certainly does play a large role in our lives

Technology certainly does play a large role in our lives and this has happened in a very short period of time. It has impacted the way we activities professionally, personally, and academically. For example, online educa ...

Suppose you would like to sort n music files using a

Suppose you would like to sort n music files using a comparison-based sorting algorithm (i.e. no bucket sort), but you only have an old, unreliable computer, which you have nicknamed "Rustbucket". Every time Rustbucket c ...

Question suppose that you are searching an unsorted array

Question : Suppose that you are searching an unsorted array of objects that might contain duplicates. Devise an algorithm that returns a list of the indices of all objects in the array that match a given object. If the d ...

Recommendations what improvements could you offer as an it

Recommendations: What improvements could you offer as an IT leader managing the strategy for the situation covered by the case? Consider time, cost, human capital, and the current status IT within the organization. Maint ...

Question suppose host a has 10 packets with sequence

Question : Suppose host A has 10 packets with sequence numbers 1 to 10 to be transmitted to host B. Now imagine that the packets numbered 2 and 7 are lost when they were sent the first time. Assume that ACKs are never lo ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As