Please update your browser
Your browser version is not supported by this site. CS First may not work properly.
In this add on, you will control
when the scanner sprite scans the background
and program the scanner to scan
for different colored backgrounds.
Your finished project scans the background
for the color black.
It only performs this action when the flag is clicked.
To make the scanner sprite scan for other backgrounds
create a way to better control when it starts.
To start, replace the when flag clicked block
with a when key pressed block.
Change the value of the block to one.
Now, the scanner sprite will start scanning
when the number one is pressed.
Test it out!
When you press one the sprite begins to move.
To apply the scanner sprite to a new background
first select a new background from the library.
The scanner will work best if you pick
a background with one consistent color.
Once you have picked a new background,
copy the code stack of the scanner sprite
by right clicking on it's code and selecting Duplicate.
Put the new code stack next to the old one.
Make the scanner sprite perform the same functions
for the new background, only, make it search for
the new background's dominant color
rather than selecting for black only.
To change which color the scanner sprite searches for
click the color box on the touching color block
in the new stack.
Click on the dominant color in the new background you chose.
Now, change when the new function happens
by changing the value of the when key pressed block
to a new key, like the number two.
Try it out by pressing two.
The scanner sprite should scan for the new color,
change it to black, and change the rest to white.
Once you finish this add on go to the project page
to add instructions to describe which key to press
to use the digital shift feature.
Once you've added instructions,
click See Inside to get back to the project editor.
Now it's your turn.
Make your code use a keypress event instead
of a green flag event.
Select a new background.
And finally, duplicate the code, change the color
of the touching color block, and change the keypress.