Return to Video

Sprites In Action

  • 0:07 - 0:09
    Now that you've learned
    how to use Sprite Lab,
  • 0:09 - 0:11
    you're going to want to make
    your program react
  • 0:11 - 0:13
    when someone plays
    with it.
  • 0:13 - 0:16
    To do that, you're going to
    use events.
  • 0:16 - 0:21
    Blocks like `when clicked` and
    `while touches` are called event blocks.
  • 0:22 - 0:24
    The code connected to
    an event block
  • 0:24 - 0:26
    runs when the approprite input,
  • 0:26 - 0:29
    like a click or a tap, is detected.
  • 0:32 - 0:37
    For example, if you attach this
    `change size by` block
  • 0:37 - 0:46
    to the `when Alien 1 clicked` event
    the sprite will change size when it's clicked.
  • 0:50 - 0:53
    Notice that event blocks don't snap
    into your main program.
  • 0:53 - 0:56
    Instead, they create
    little programs of their own.
  • 0:57 - 1:01
    Remember that even if the event
    only happens one time,
  • 1:01 - 1:03
    behaviors will go until you stop.
  • 1:05 - 1:07
    You can use a `stops` block
  • 1:07 - 1:10
    if you don't want multiple events
    to combine behaviors.
  • 1:32 - 1:35
    Using events, you can create
    imaginative programs
  • 1:35 - 1:37
    and interactive worlds.
  • 1:37 - 1:38
    Give it a try!
Title:
Sprites In Action
Description:

more » « less
Video Language:
English
Team:
Code.org
Project:
CSF '21-'22
Duration:
01:46

English subtitles

Revisions Compare revisions