-
Hour of Code | Dance Party: Events
-
I'm Aloe Blacc.
-
I'm a singer/songwriter and entertainer.
-
I think computer science is really important to learn
-
because computer science is the future.
-
And I think it's important for people to be in control of the technology
-
that is literally controlling their lives.
-
To make different dance moves happen at just the right time with the music,
-
you can use something called events.
-
An event tells your program to listen for something to happen,
-
and then react right away.
-
Some examples of events are listening for a mouse click,
-
an arrow button, or a tap on the screen.
-
The event we're going to use now will listen for a change in the song.
-
The change will trigger your dancer to do a new dance.
-
Professional dancers practice their choreography by counting the beats of the song.
-
In music, a measure refers to a certain number of beats.
-
In most popular songs a measure is 4 beats long.
-
To get your dancers to let loose, you'll need a green event block.
-
This event block says after four measures.
-
If you drag out a purple 'do forever' block, you can pick a dance for your dancer to do.
-
Because it's under the after four measures event block,
-
your dancer will wait for four measures of the song before starting their dance.
-
Keep an eye on the measure counter at the top of the display area.
-
Look and listen for the event that will
trigger the dance code...
-
and right on cue our dancer starts going!