Skip to content
Transcript

This add on will create a sprite that changes colors when the mouse hovers over it, making it eye catching as window shoppers pass by your storefront.

To start, click on the choose new sprite from library and add a new sprite.

This project we'll use the sun but you can pick any sprite you'd like.

Next, make the sprite change colors.

To start, drag a change color effect block from the looks menu into your scripts editor.

Click the block to see what it does.

That looks cool but in this add on the sprite should change colors only when it is touching the mouse pointer.

To make that happen, use an if then statement in a sensing block.

Place an if then statement around your change color effect block.

This block stack now reads.

If something happens, change the color effect of the sprite.

Next, add the condition that must be set in if portion of the if then block in order to make the sprite change colors.

You want the sprite to change color when it touches the mouse.

So add a touching block from the sensing menu.

Drag out a touching block and place it inside the if then block.

From the options and the drop down menu, choose mouse pointer.

Now it reads, if the sun is being touched by the mouse pointer, then the color effect should change.

Click on this block stack to test it.

Nothing happens.

Your program needs to continuously check if the sprite is touching the mouse pointer.

Add a forever loop around the if then block.

Now test your code.

Awesome.

Finally, add a win fly clicked event block to run this code when your program starts.

Now it's your turn.

Add a new sprite and create an if then statement.

Add a touching mouse pointer sensing block.

A forever loop.

And a change color effect block to make the sprite change colors when the mouse pointer touches it.

Test your code and ask a neighbor if you need any help.

Choose an Add-On

Color Change

Create a sprite that changes colors when the mouse hovers over it.

Drift

Create a sprite that will perform different actions in response to its surroundings.

Hidden Surprise

Code a hidden surprise in your display window.

Go Crazy

Code your sprite to go crazy when the mouse-pointer touches it.

Talk about it (Challenge)

Add talking sprites in your program.

Shooting Sprites (Challenge)

Make a sprite shoot across the stage.

Instructions

  1. Choose an Add-On, and click "watch" to learn how to build it.
  2. Once you finish one Add-On, try another one below the video!
Attributions
  • "Grand Opening' by csf11191 (https://scratch.mit.edu/projects/44999602/) -- Licensed by CC BY-SA 2.0 (https://creativecommons.org/licenses/by-sa/2.0/)
  • "Window Shopper Starter Project remix" by csf18500 (https://scratch.mit.edu/projects/40063188/) -- Licensed by CC BY-SA 2.0 (https://creativecommons.org/licenses/by-sa/2.0/)
  • "Window Shopper Starter Project remix" by csf3400 (https://scratch.mit.edu/projects/43007680/#editor) -- Licensed by CC BY-SA 2.0 (https://creativecommons.org/licenses/by-sa/2.0/)
  • "Window Shopper Starter Project remix" by csf21653 (https://scratch.mit.edu/projects/50079138/) -- Licensed by CC BY-SA 2.0 (https://creativecommons.org/licenses/by-sa/2.0/)