Making a Kaleidoscope
Unit 2 Optional Project
In this project, you will build an app that lets you draw like a kaleidoscope.
One sprite is following the mouse. Three other sprites are reflecting the movement of that sprite in slightly different ways.
-
“U2-Kaleidoscope”
-
First, create and test code to make the first sprite follow the mouse and draw a line tracing its path.
- Use an event to trigger the kaleidoscope behavior so that users don’t have to open each sprite and click each script to start the drawing.
- Make the sprite draw only when the mouse is down (You’ll need to uncheck the “draggable” box so Snap! doesn’t think you are trying to drag the sprite when you click.)
You learned how to make the sprite follow the mouse in Unit 1 Lab 5 Page 1: Sprite Following the Mouse. You learned how to detect an event on Unit 1 Lab 1 Page 2: Programming a Game. And you learned how draw only when the mouse is down by using
if else
withmouse down?
in Unit 2 Lab 3 Page 1: What’s a Predicate?. -
Create a second sprite that mirrors the movement of the first one.
One way to create the second sprite is to duplicate the first one and modify it. Right-click the sprite-button in the sprite corral (in the lower right of the Snap! window), and select “duplicate” from the context menu that appears. The new sprite will have the same scripts as the original, which is why duplication is easier than creating new sprites from scratch.
Need a hint about making the second sprite mirror the first one?
You’ll want the second sprite either to go to the same x-position and the inverse y-position or to go to the inverse x-position and the same y-position.
Use inside .
-
Test your code and debug any problems.
You may wish to use an event (such a pressing the “c” key) to tell the program to clear the stage and stop all scripts. This will make testing and debugging easier.
-
Create two more sprites that mirror the two you have.
If your second sprite mirrored the first horizontally, then the third and fourth sprites should mirror those vertically, and vice versa.
-
Experiment with some of the following ideas, or make up your own changes to the kaleidoscope.
-
Change the pens:
- Add some colors.
- Adjust the pen sizes.
You learned about
set pen color
andset pen size
on Unit 1 Lab 3 Page 1: Exploring Motion. -
Create more sprites:
-
Add new sprites that use
mouse x
as the y input andmouse y
as the x input. - Add new sprites that are shifted some distance away from another sprite.
-
Add new sprites that use
- Create variations of your own.
-