Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Scratch 1.4: Beginner's Guide

You're reading from   Scratch 1.4: Beginner's Guide Learn to program while creating interactive stories, games, and multimedia projects using Scratch

Arrow left icon
Product type Paperback
Published in Jul 2009
Publisher Packt
ISBN-13 9781847196767
Length 264 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Step into the light, please


While our Scratch sprites can't see the outside world, we can use the light sensor on the PicoBoard to control a sprite based on the amount of light detected by the sensor.

For this exercise, we'll modify a dragon sprite and make it grow based on the amount of light it receives.

Time for action

Scratch includes several sprites that have scripts by default, which means the sprite is already programmed to do something. We're going to use such a sprite to jump-start this exercise:

  1. Open a new Scratch project, and select the choose new sprite from file option.

  2. Open the Fantasy folder and select the Growing Dragon sprite. It's the dragon designated as having 1 script.

  3. The sprite contains one simple script that sets the size of the dragon based on the loudness block. Click the flag and make some noise. See the dragon expand and contract.

  4. Now, replace the loudness block that's inside the set size to block with the sensor value block. Select light from the drop-down list.

  5. Enable...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image