chapter 5 interaction: events and event handling

Download Chapter 5 Interaction: Events and Event Handling

If you can't read please download the document

Upload: isabella-ferguson

Post on 17-Jan-2018

229 views

Category:

Documents


0 download

DESCRIPTION

How can parameters affect an event handler? A.They can allow it to vary the action based on the parameter value B.They can let you do more than one thing in the action C.They can let you click on an object to control the action

TRANSCRIPT

Chapter 5 Interaction: Events and Event Handling The area indicated below contains what? A.My First Method because thats what is always done first B.An event -- a mouse click or key press C.An event handler method D.A parameter How can parameters affect an event handler? A.They can allow it to vary the action based on the parameter value B.They can let you do more than one thing in the action C.They can let you click on an object to control the action Building my OWN flight simulator: What will the plane do when the right arrow button is pushed? A.Turn left B.Turn right C.Alice will complain that there is a logic error D.I dont know Chapter 5: Interactive Worlds with Event Handling Instead of having animation controlled by a specific method (every time) like my first method Control can vary based on a set of possible events Create an event link to a method Multiple methods can link to same event but perhaps with different parameters What code runs when you hit play? Essentially a method listening for you to click or push a button it listens over and over again Identify the parameters in the following event link 1 IceSkater 2 kick3 iceSkater. rightLeg 4 iceSkater.rightLeg. lowerLeg.foot AXXXX BXXX CX DXX Whoever is clicked on should go Suppose we have a world where the same thing should happen to whatever object when we click on it. Suppose we have a game where whatever object is clicked on should Turn to face an object (say a flower) Then jump over it Well discuss two ways to do it The second one is better. Either the monkey or the hare jumps over the flower Lets see what that looks like One way to set up the events is But is there a better way? Is there a better way? A.No, this is as good as it gets, because you need to be able to have a different parameter to the jump method, depending on who you click on B.Yes, I can tell you one