Events

Event Driven Programming

Some computer programs just run and continue on their own with no input from the user e.g. your program to play a tune. However, many programs react to events (things that happen), such as: ● the click of a mouse or press of a key; ● the tilt of a game controller; ● a swipe of a smartphone screen; ● a body movement detected by a motion-sensing controller such as a Kinect Often used to start a program. ||
 * In Scratch, event blocks have a curved top (sometimes called a “hat”): ||  ||
 * [[image:abcprogramming/event 1.gif]] || Reacts when the green flag is clicked.
 * [[image:event 2.gif]] || Reacts when a key is pressed. Click the small black triangle to select the key you want to detect. Useful for controlling a sprite, or triggering an action. ||
 * [[image:event 3.gif]] || Reacts when a sprite is clicked. Useful for controlling characters in a program. ||