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

Control motion with the slider


Next, we'll explore the slider sensor as we manipulate some gravity marbles. Like the sound and the light sensors, the slider outputs a numeric value between 0 and 100.

Let's experiment with Earth's greatest force.

Time for action – slide sensor

Like we did with the light sensor exercise, we're going to open a sprite that already has scripts associated with it. In this case, we'll use the gravity marbles.

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

  2. Delete the original sprite.

  3. Open the Things folder and select the Gravity Marble sprite.

  4. Click the flag and interact with the marble by pressing the arrow keys to make the marble rise and fall. Try to understand the code. When you've had enough, continue with the next step.

  5. We want to raise the marble with the slider sensor on the PicoBoard. Replacethe if key up arrow pressed ? block with the greater than block from the Operators palette.

  6. From the Sensing palette, add the sensor value block...

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