1 00:00:02,000 --> 00:00:06,000 Hour of Code | Dance Party: Events 2 00:00:09,360 --> 00:00:10,720 I'm Aloe Blacc. 3 00:00:10,720 --> 00:00:14,080 I'm a singer/songwriter and entertainer. 4 00:00:14,080 --> 00:00:16,840 I think computer science is really important to learn 5 00:00:16,840 --> 00:00:19,240 because computer science is the future. 6 00:00:19,240 --> 00:00:25,680 And I think it's important for people to be in control of the technology 7 00:00:25,680 --> 00:00:29,040 that is literally controlling their lives. 8 00:00:29,520 --> 00:00:34,559 To make different dance moves happen at just the right time with the music, 9 00:00:34,560 --> 00:00:38,080 you can use something called events. 10 00:00:38,080 --> 00:00:42,160 An event tells your program to listen for something to happen, 11 00:00:42,160 --> 00:00:44,320 and then react right away. 12 00:00:44,320 --> 00:00:48,800 Some examples of events are listening for a mouse click, 13 00:00:48,800 --> 00:00:54,360 an arrow button, or a tap on the screen. 14 00:00:54,360 --> 00:00:58,880 The event we're going to use now will listen for a change in the song. 15 00:00:58,880 --> 00:01:03,640 The change will trigger your dancer to do a new dance. 16 00:01:03,680 --> 00:01:10,360 Professional dancers practice their choreography by counting the beats of the song. 17 00:01:10,360 --> 00:01:14,960 In music, a measure refers to a certain number of beats. 18 00:01:14,960 --> 00:01:20,440 In most popular songs a measure is 4 beats long. 19 00:01:20,440 --> 00:01:24,870 To get your dancers to let loose, you'll need a green event block. 20 00:01:24,880 --> 00:01:30,200 This event block says after four measures. 21 00:01:30,200 --> 00:01:37,240 If you drag out a purple 'do forever' block, you can pick a dance for your dancer to do. 22 00:01:37,240 --> 00:01:40,840 Because it's under the after four measures event block, 23 00:01:40,840 --> 00:01:46,720 your dancer will wait for four measures of the song before starting their dance. 24 00:01:46,720 --> 00:01:51,100 Keep an eye on the measure counter at the top of the display area. 25 00:01:51,100 --> 00:01:55,520 Look and listen for the event that will trigger the dance code... 26 00:01:55,520 --> 00:02:00,320 and right on cue our dancer starts going!