Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

Choose an Add-On
play_circle_filled
Color Change
Create a sprite that changes colors when the mouse hovers over it.
arrow_forward
play_circle_filled
Drift
Create a sprite that will perform different actions in response to its surroundings.
arrow_forward
play_circle_filled
Hidden Surprise
Code a hidden surprise in your display window.
arrow_forward
play_circle_filled
Go Crazy
Code your sprite to go crazy when the mouse-pointer touches it.
arrow_forward
play_circle_filled
Talk about it (Challenge)
Add talking sprites in your program.
arrow_forward
play_circle_filled
Shooting Sprites (Challenge)
Make a sprite shoot across the stage.
arrow_forward
  • 1. Add a Sprite for Your Store Window
  • 2. One Sprite Flies
  • 3. Clone the Flying Sprite
  • 4. Sprites Look Alive
  • 5. Add-Ons
  • 6. Reflection
  • 7. Wrap-up: Window Shopper
  • 8. Wrap-up: Share Your Project
  • 9. Wrap-up: Show Your Project
arrow_backward Back Next arrow_forward
Transcript

This add-on will walk you through how to code your sprite to spin when the mouse pointer touches it.

To start, click on “choose new sprite from library” to add a new sprite.

This project uses the Helicopter so shoppers can interact with it and make it go crazy in the window display, but you can pick any sprite you’d like.

Use the shrink tool to make your sprite smaller on the stage.

Next, program the sprite to spin. Drag out a “turn” block, and place a repeat loop around it. Click the block stack to try it out.

Tinker with the values inside the repeat loop and the turn block. Putting a higher number in the turn block, like 120, will make your sprite turn faster.

To make the helicopter turn when touching the mouse-pointer, use an “if-then” statement.

Place this around the repeat loop, and add a “touching mouse-pointer” sensing block.

For this code stack to keep running and checking for the mouse-pointer, add a forever loop around the code. Click the block stack to test it out!

Awesome! It works. Make sure to add a “When flag clicked” event to run this code when the flag is clicked. To make the sprite randomly move around the screen, add a “move 10 steps” block to your program under the forever loop.

Test it out. The helicopter runs to the edge of the screen and disappears Fix this by adding an “if on edge, bounce” block. This block checks to see if the sprite is touching the edge of the screen. If it is, it points it in the opposite direction, making it bounce. Now, shoppers can interact with the helicopter and make it go crazy!

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!