< Return to Video

Hello World - Programming with Events

  • 0:08 - 0:11
    Now that you've learned
    how to use Sprite Lab, you're going
  • 0:11 - 0:14
    to want to make your program react
    when someone plays with it.
  • 0:15 - 0:17
    To do that, you're going to use events.
  • 0:18 - 0:20
    An event tells your program to listen
  • 0:20 - 0:23
    for something to happen
    and then react right away.
  • 0:24 - 0:28
    Some examples of events are listening
    for a mouse, click
  • 0:28 - 0:31
    an arrow button, press
    or a tap on the screen
  • 0:33 - 0:37
    blocks like when clicked are called
    event blocks.
  • 0:38 - 0:40
    The code connected to an event
    block runs
  • 0:40 - 0:42
    when the appropriate action is detected.
  • 0:44 - 0:45
    For example,
  • 0:45 - 0:50
    if I attach this say block to the
    when clicked event,
  • 0:50 - 0:53
    my sprite will say something
    when the user clicks
  • 0:53 - 0:55
    or taps on it.
  • 0:57 - 1:01
    Notice that event blocks
    don't snap into your main program.
  • 1:01 - 1:04
    Instead, they create
    little programs of their own.
  • 1:10 - 1:12
    If you have multiple sprites,
  • 1:12 - 1:15
    you can use additional events
    to tell an interactive story.
  • 1:17 - 1:19
    Hello, Pizza!
  • 1:20 - 1:22
    Avocado, my friend!
  • 1:23 - 1:26
    You'll soon be learning
    how to do even more in Sprite lab,
  • 1:27 - 1:30
    including changing the size
    or appearance of a sprite,
  • 1:30 - 1:34
    setting different backgrounds, playing
    sounds, and more.
  • 1:35 - 1:38
    What do you want your sprites to do
    when someone interacts with them?
  • 1:39 - 1:40
    It's up to you.
Title:
Hello World - Programming with Events
Description:

more » « less
Video Language:
English
Team:
Code.org
Project:
Hour of Code
Duration:
01:50

English subtitles

Revisions