Class Notes (1,100,000)
CA (630,000)
SFU (10,000)
IAT (200)
IAT 167 (30)
Lecture 4

IAT167-Week 4 Lecture 1 and 2.docx


Department
Interactive Arts & Tech
Course Code
IAT 167
Professor
Jack Stockholm
Lecture
4

This preview shows half of the first page. to view the full 2 pages of the document.
Week 4 Lecture 1 and 2
Event Driven Programming and Game Difficulty
An event is a notification that occurs in response to an action, such as a change in state, or as a
result of the user clicking the mouse or pressing a key while viewing the document.
Event-driven Programming
Programming paradigm in which the program flow is determined by events
An architecture where the application has a main loop divided into two sections:
Event Selection / Detection
Interrupts
Event Handling
Event Dispatcher the Event Source or Provider, the sender of the event
Event the object sent
Event Listener or Consumer the receiver of events
Handler / Listener Function - a function that receives control when the corresponding event
occurs
Event Dispatcher
addEventListener
hasEventListener
removeEventListener
dispatchEvent
willTrigger
Events
bubbles : Boolean
Indicates whether an event is a bubbling event.
cancelable : Boolean
Indicates whether the behavior associated with the event can be prevented.
currentTarget : Object
The object that is actively processing the Event object with an event listener.
eventPhase : uint
The current phase in the event flow.
target : Object
The event target.
type : String
The type of event.
Event Listener
Asynchronous Callback subroutine
You can have multiple Event Listeners on one Event Dispatcher
Can be listening for the same event or different events
Manage and clean-up Event Listeners
You're Reading a Preview

Unlock to view full version