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

  Define header files

Define Header files. Define main()function Declare local variables and assigning values to variables.

  What are the benefits/disadvantages of this technology

What are the benefits/disadvantages of this technology?

  Verifying the signatures of mails

i. Is he still able to send encrypted mails? What about receiving? ii. Is he still able to sign the mails he sends? What about verifying the signatures of mails he receives? iii. What must he do to again be able to carry out all the operations mentio..

  What is the cyclomatic number of the program

Identify all independent execution path (basis path) in this program.

  Determines the current stock price

1. The stock valuation model that determines the current stock price as the next dividend divided by the (discount rate less the dividend growth rate) is called the:

  Program that accepts 10 integers and determines and prints

write a program that accepts 10 integers and determines and prints the smallest and largest integer input by the user. Your program should use at least the following four variable

  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.

  Research details of ad of current web site or magazine

Pick a current web site or magazine ad for a complete, working computer system, including computer, monitor, keyboard, and software, together with extra devices such as a mouse or printer

  Design interface for government for identifying terrorists

As part of the design team on a major government defense project, it is time to create your first mock-up of this terrorist identification and tracking user interface.

  Display the attributes of a file

discuss whether they are more likely to be delay sensitive or bandwidth sensitive.

  Define a header and data format

Purpose: This program will generate a series of random numbers and produces a table containing these values and some statistics about them. The program should define a Header and Data format string to output results as shown in the sample at the bo..

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