When should events be used instead of loops

Assignment Help Basic Computer Science
Reference no: EM131111357

In Exercise 9, why is it better to use an event instead of a loop to make the pterodactyl continue flying while the world is running?

In general, when should events be used instead of loops in computer programming?

Exercise 9

The Animals object gallery contains a pterodactyl. The student data files for this book have a world named flapping pterodactyl with a character-level method named flap that will cause the pterodactyl to flap its wings. Do each of the following:

a. Create a method called pterodactyl fly that will make the pterodactyl move forward while flapping its wings, and then create a loop in world.my first method to make the pterodactyl fly away.

b. Add controls to your pterodactyl world so that the user can steer the pterodactyl.

c. Add a user control to point the camera at the pterodactyl when the spacebar is pressed.

d. Modify the world to use an event instead of a loop to make the pterodactyl fly while the world is running. You might need to refer back to Chapter 3, which covers events.

Reference no: EM131111357

Questions Cloud

The scattergrams of part a to evaluate the performance : The Minnesota Department of Transportation installed a state-of-the-art weigh-in-motion scale in the concrete surface of the eastbound lanes of Interstate 494 in Bloomington, Minnesota.
Create an alice world with a character of your choice : Create an Alice world with a character of your choice that will ask the user for a number, cause the character to jump up, use a loop to spin around the number of times specified, and then come back down. Think about how variables will be used as ..
How does the type of carbohydrate impact health : What is meant by the AMDR, and what is this range for carbohydrates? How does the type of carbohydrate impact health? What is one negative health impact from carbohydrate intake?
Interpretation of the triple constraints : First, review the "triple constraints" of IT Project Management as covered in this week's reading "What is Project Management?" Note that there are more than 3 constraints discussed in the article. The illustration above from the article shows the..
When should events be used instead of loops : In general, when should events be used instead of loops in computer programming?
Find the equation of the least squares line : A large proportion of US. teenagers work while attending high school. These heavy workloads often result in underachievement in the classroom and lower grades.
Describe an alice event of the bde format : Describe an Alice event of the BDE format that will make a ballerina jump up when a key is pressed, spin around for as long as the key is held down, and return to the ground when the user lets go of the key.
Quality of the software that we produce : How do we ensure the quality of the software that we produce? How do we successfully institute new software technologies?
Write a one-page report on homer and the iliad : Write a one-page report on Homer and the Iliad. Be sure to include a synopsis of the literary piece.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Non-traditional channels of monetary policy

What do you think about the non-traditional channels of monetary policy? Could you provide an example of a variable or set of variables that could show non-traditional channels of monetary policy? Describe and explain.

  Telephone service providers are now offering adsl

4. (4 points) Telephone service providers are now offering ADSL service to home using the existing twisted-pair telephone wires. The signal can be carried up to a maximum of 1-MHz baseband with an S/N (signal power/noise power in ratio) of 30 d..

  Add the form which includes richtextbox control

Add the form which includes RichTextBox control and several predefined template letters. This part of program would be used to write letters to your customers.

  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..

  Calculate the velocity and acceleration vectors

Calculate the velocity and acceleration vectors and the speed at t=pi/4 for a particle whose position at time t isgiven by vector r(t)=(cost t) i +( cos 2t) j +( cos 3t) k.

  Write programs to implement efficiently

In general, this problem is very hard, and no efficient solution is known. Write programs to implement efficiently the following approximation strategies

  Which sql statement is used to extract data from a database

Which SQL statement is used to extract data from a database?

  Cybersecurity plays in your use of that technology

Write a 3-4 page paper plus cover page on How information technology affects your everyday life and what role do you think Cybersecurity plays in your use of that technology. Write in APA 6th Edition

  Describe areas where you see disagreement between authors

Include any information you believe adds to the material in the text. Describe any areas where you see disagreement between the two authors.

  A direct-mapped cache with 8 two-word blocks

Based on the following sequence of word addresses generated by the processor:1, 134, 212, 1, 135, 213, 162, 161, 2, 44, 41, 221a) Given a direct-mapped cache with 8 two-word blocks that is initially empty

  Why is accessing a disk block expensive

Why is accessing a disk block expensive?

  Configuration and implementation of a cluster computing

Develop and submit a project plan including implementation steps for the configuration and implementation of a cluster computing solution to support a mission critical application

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