Be Reflective: Mirror Images

Objective

After completing this lesson, you will be able to execute parts of your program based on a condition using the if-else control structure to create an interactive drawing app.

Content

Video summary:

The video walks through building an interactive symmetrical drawing app in Snap!. It shows how to let a program run based on user interaction by making a sprite follow the mouse. Conditionals are introduced as a way to execute parts of a program based on a condition - in this case the pen is put up or down based on if the mouse is clicked. The video also touches upon parallelism, several scripts are triggered by the green flag and several sprites run in parallel. By duplicating the sprite and mirroring its x coordinate (0 - mouse x), you get a live mirrored drawing (kaleidoscope-style). The tutorial also covers making the sprite undraggable, clearing the stage, and adjusting pen color/size.

Key points:

  • Have a sprite follow the mouse with a forever loop (go to mouse or go to x: mouse x y: mouse y).
  • Use an if-else statement with the mouse-down event to toggle pen down/up for drawing on click.
  • Duplicate the sprite and mirror coordinates (e.g., x → 0 - mouse x) to draw symmetrical/mirrored output.
  • Use green flag/space key scripts for parallel behavior and reset/clear; adjust pen color and size for effect.