Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Scratch 2.0 Beginner's Guide: Second Edition
  • Table Of Contents Toc
Scratch 2.0 Beginner's Guide: Second Edition

Scratch 2.0 Beginner's Guide: Second Edition

By : Badger
4.3 (4)
close
close
Scratch 2.0 Beginner's Guide: Second Edition

Scratch 2.0 Beginner's Guide: Second Edition

4.3 (4)
By: Badger

Overview of this book

The book uses step-by-step instructions along with full code listings for each exercise. After each exercise, the author pauses to reflect, explain, and offer insights before building on the project. The author approaches the content with the belief that we are all teachers and that you are reading this book not only because you want to learn, but because you want to share your knowledge with others. Motivated students can pick up this book and teach themselves how to program because the book takes a simple, strategic, and structured approach to learning Scratch. Parents can grasp the fundamentals so that they can guide their children through introductory Scratch programming exercises. It’s perfect for homeschool families. Teachers of all disciplines from computer science to English can quickly get up to speed with Scratch and adapt the projects for use in the classroom.
Table of Contents (13 chapters)
close
close
12
Index

Time for action – adding a variable to track lives

As we make the game more difficult, it will be appropriate to provide the player with more than one opportunity to clear the game. We'll do this by tracking the player's lives, as shown in the following steps:

  1. Create a variable named lives. You can create it For all sprites.
  2. Let's set the starting value of the new variable at the start of the game. Select the ball sprite. Then, add a set () to () block to the when flag clicked stack, which sets the ball's initial position and direction.
  3. Select the lives variable and enter the value 3.
  4. Next, we need to change the logic that ends the game to check for life. To do this, detach the stop (all) block from the wait until (y position) < (y position) of (paddle) block.
  5. Instead of stopping everything, let's decrease the value of the lives variable. Add a change () by () block to the bottom of the stack. Select the lives variable and enter a value of -1 in the by value...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Scratch 2.0 Beginner's Guide: Second Edition
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon