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
Free Learning
Arrow right icon
Raspberry Pi Projects for Kids (Second Edition)
Raspberry Pi Projects for Kids (Second Edition)

Raspberry Pi Projects for Kids (Second Edition): Leverage the power of programming to use the Raspberry Pi to create awesome games

eBook
€10.99 €16.99
Paperback
€20.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Raspberry Pi Projects for Kids (Second Edition)

Chapter 2. Animating with Scratch

In this chapter, we're going to use a programming language called Scratch to create a simple animation. Along the way, we'll visit many of the main concepts of programming languages, so if you understand everything that you learn in this chapter, you will be well equipped to start writing programs of your own.

Scratch

In this chapter, we will use Scratch to create our animation. Scratch is a programming language that has been specially designed so that you can make animations and games with ease. Version 1.4 of Scratch is pre-installed with the Raspbian OS but is also available on other computers. You can download it from http://scratch.mit.edu/ if you ever want to run your programs away from your Raspberry Pi. Start up Scratch by opening Menu at the top of the screen, and navigating to Programming, and then Scratch.

Tip

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

The following screenshot shows the layout of Scratch:

Scratch

The following are its main sections. I'll mention the names of these sections throughout the next two chapters, so...

Interactive animation

We now have two different animated sprites, each doing their own thing. One of the special features of Scratch is that it makes interactive animation simple—we can program a sprite to react to you!

Create a new sprite in the same way as you did before using the Choose new sprite from file button. For this animation, we're going to have a simple conversation with the user, so choose an image of something that can talk. Find a good position and size for the new sprite, then build the following script in its script area:

Interactive animation

There are a few new code blocks here. Let's go through them one by one:

  • ask and wait: This gives the sprite a speech bubble, asking a question in a box. This block can be found in the Sensing section. The script will stop until the user has typed an answer into a text box on screen.
  • answer: The answer to the question is stored in this block, and is also in the Sensing section.
  • join: This takes two pieces of text and merges them into a longer...

Summary

In this chapter, we explored a few different ways of creating animations in Scratch. Along the way, we used a wide selection of the available code blocks. Many of these blocks are very similar to those used in other programming languages—you will recognize them in later chapters.

Importantly, you should recognize that this is your program, and you are free to change it as you like. You can change the way any of the sprites look, you can change any of the text or numbers, and you can even change which blocks are used to change the behavior of the program.

In the next chapter, we will continue the theme of making things interactive by building an entire game in Scratch – a version of Angry Birds which you will be able to modify to suit you.

Left arrow icon Right arrow icon

Description

This book is for kids who wish to develop games and applications using the Raspberry Pi. No prior experience in programming is necessary; you need only a Raspberry Pi and the required peripherals.

Who is this book for?

This book is for kids who wish to develop games and applications using the Raspberry Pi. No prior experience in programming is necessary

What you will learn

  • Gear up to start programming by setting up the Raspberry Pi and taking a tour of available applications
  • Understand the fundamentals of programming and electronics using the Raspberry Pi
  • Use the Linux operating system and programming languages such as Scratch and Python to build interesting projects
  • Gain a basic understanding of how the Python programming language works by writing simple programs
  • Build a fully functioning game and explore how to modify it to create new levels
  • Create animations and music to make your games and applications more exciting
  • Make computer code interact with the physical world
  • Add markers to your personal mapping program
  • Get an understanding of Sonic Pi, and discover how to use it to create your own music
Estimated delivery fee Deliver to Spain

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Apr 28, 2015
Length: 146 pages
Edition : 1st
Language : English
ISBN-13 : 9781785281525
Vendor :
Raspberry Pi
Category :
Languages :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Spain

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

Product Details

Publication date : Apr 28, 2015
Length: 146 pages
Edition : 1st
Language : English
ISBN-13 : 9781785281525
Vendor :
Raspberry Pi
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 71.97
Raspberry Pi Projects for Kids (Second Edition)
€20.99
Python Projects for Kids
€29.99
JavaScript Projects for Kids
€20.99
Total 71.97 Stars icon
Banner background image

Table of Contents

8 Chapters
1. Getting Started with Raspberry Pi Chevron down icon Chevron up icon
2. Animating with Scratch Chevron down icon Chevron up icon
3. Making Your Own Angry Birds Game Chevron down icon Chevron up icon
4. Creating Random Insults Chevron down icon Chevron up icon
5. Testing Your Speed Chevron down icon Chevron up icon
6. Making an Interactive Map of your City Chevron down icon Chevron up icon
7. Building Beats with Sonic Pi Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.4
(5 Ratings)
5 star 60%
4 star 20%
3 star 20%
2 star 0%
1 star 0%
Amazon Customer Oct 10, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
[Disclaimer & Explanation] I reviewed this book in MagPi magazine #35 - appreciating its concise and concentrated introduction to programming via the Pi, and recommend it for confident learners - or those with a knowledgable parent to call upon for occasional help. The review is reproduced below (like all of MagPi, it's available under CC-by-SA terms)."The Raspberry Pi exposes programming software to make it as easy as possible to get started," says Bates in his preface. After a chapter on getting set up with the Pi, the book launches into trying out programming through six mini projects, starting with the excellent Scratch visual programming language: first to do some animation, with programming concepts – and the power and freedom of programming – introduced as a natural part of learning the animation procedure; then an Angry Birds clone, that includes physics (gravity and bouncing), scoring, and a chance to add in your own extensions.Python is next, with a random insults generator - always a popular bit of fun - which introduces list handling and functions. Then a connection to the physical world: first through an excellent DIY game controller for a speed test game, then with Google maps and tkinter to look at your neighbourhood. Lastly, an introduction to music making with software, through SonicPi.All in all this software focussed introduction gives a quicker starting path than many of the more maker-oriented Pi books, which themselves would make an ideal follow on. After working through Bates's readable and friendly guide, any child will know a surprisingly large amount of core programming skills, as well as a thirst for more. Recommended.
Amazon Verified review Amazon
Eagleeye Jul 11, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
good book
Amazon Verified review Amazon
Jaume Aragay Badia Oct 08, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The book begins with the installation process of the operating system on the memory card and also a list of the most common difficulties and their solution. On all the chapters the text offers the basic information needed but also links external references for extra information on the topics covered.After the Raspberry Pi is working properly, we meet Scratch, a graphic language that allows you to make your first programs assembling graphic blocks like with LEGO. This way you don't have to care about writing code properly. There is no code to write, you just assemble the orders to form a program. With Scratch you begin with simple animations and after that you make your own Angry Birds Game.On the next chapter you use Python. Python is a language with an easy syntax that has much more possibilities that Scratch. You will use structures like IF-ELSE to make branches in your programs to reach new heights in your programming skills. Then you use a physical controller to interact with the Raspberry Pi board to broaden even more the possibilities.After that you interact with external resources like Google Maps to make an interactive map of your city.The last chapter moves in a different direction to use Sound in the Raspberry Pi to see new opportunities.As I said before, this book is great for introduction to the possibilities of the Raspberry Pi board and also offers branches to new sources of information to broaden the knowledge on the topic. Very clearly written and explained.
Amazon Verified review Amazon
Gopinath Palaniappan Oct 09, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
I had a couple of older versions of Raspberry Pi's lying around. I was wondering if I could let my 11yr old tinker with dad's favorite inexpensive SBC. Thanks to +Packt Publishing and +Fahad Siddiqui for some great books to help bootstrap the kid. Here's my review of the books.Raspberry Pi Projects for Kids - Second Edition"Leverage the power of programming to use the Raspberry Pi to create awesome games"Author: Daniel BatesAs the name suggests, its a book for kids. You don't need any prior experience to use the book. Hence its perfect for a kids new to Raspberry Pi. You do need a Raspberry Pi to enjoy all the hardware projects, but I realized after reading the book that it does a decent job introducing kids to Scratch and Python. In fact you don't need the Raspberry Pi for the first 4 chapters. You can learn Scratch and Python programming without it.Here's a rough breakdown of the chapters:* C1 : Includes basic setup of Raspberry Pi, installation of software on Raspberry Pi* C2 : Introduces Scratch programming* C3 : You make your own Angry Birds game in Scratch* C4 : Introduces you to Python* C5 : Make your own game controller and program it using Python* C6 : GUI application, Google maps* C7 : Sonic Pi application to teach musicI let my kid read the book. Since he was already familiar with Scratch, it was easy for him to zip thru till Chapter3. He kind of got lost in the middle of Chapter4. The paradigm shift into a non visual programming language was like a jolt for him. There was nothing to drag and drop. Too many concept to grasp in one sitting.I asked him to skip the chapter to the next. Chapter 5 started of interestingly with building of a game controller with some handy office supplies. My son was exited to create his own version using play-dough and some conducting tape. But he didn't have the patience to work on the code. I jumped in and filled in to get the project working.We skipped Chapter6 as well and moved on to another favorite part of the book, to create music with code. My son goes to Piano classes and recently figured out how to play STAR WARS theme song. He was so exited to code that into Sonic Pi and hear his favorite music play.Over all it was a fun experience. It even included code samples on Packt Publishing website. On the positive side, its exactly what I needed a quick jumpstart for my kid. On the downside, I wish it had a little more hands-on with Raspberry Pi hardware, rather than focus on software alone. The later chapters were also hard for my son to follow along. But thats a good thing..it will be something he can revisit in an year and find it fun to work on.I would highly recommend this book to anyone looking to get your kids jumpstarted on programming or getting introduced to hardware. For $35 Raspberry Pi is an affordable way to let your kid introduced to computers...let them tinker and make mistakes.. thats how they learn and thats how I learned growing up.Link to the books:http://www.amazon.com/dp/1785281526 [$11.99 kindle/$24.99 print]https://www.packtpub.com/hardware-and-creative/raspberry-pi-projects-kids-second-edition [$19.99 ebook/$24.99 print]
Amazon Verified review Amazon
MRL Oct 09, 2015
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
The first chapter of the book follows a tradition of other Pack books about Raspberry Pi and describes the system and how to set it up.In the second chapter, the author introduces the main programming language featured in the book: Scratch.This chapter represents a good introduction to the language and to program a simple animation, while the next one goes deeper on the language, using another game as an example.The fourth chapter deals with Python. I must admit that, in my opinion, this chapter aims to cover too many subjects at once. It might prove to be difficult for the reader to absorbe all the information provided.But if the reader manages to keep up with everything, there are a lot of useful examples and all the main features of Python are discussed.In the fifth chapter, the user is guided through creating a game that is programmed in Python, and the author shows how to create a simple game controller, building it from scratch.After this, there’s a chapter that focuses on using Google Maps inside a Python program and teaches how to personalize a program adding buttons and other widgets to it.The last chapter focuses on how to play notes and songs using Sonic Pi. Readers will understand how to do it via simple commands, writing a program that acts as a complete composer.The entire book is full of really interesting examples, but I am under the impression that it shows the readers the pros and cons of different technologies without going deeper in any of them. A little more that 120 pages can’t be enough to discuss all the fascinating topics mentioned in the book.The book doesn’t seem to be suitable for kids, but it would be a good choice for parents who want to learn to program captivating games, maybe to share them with their children.In this way, it can be wonderful choice, but if you want to continue to program games, you are bound to need further reading, at least about Scratch and Python.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact [email protected] with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at [email protected] using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on [email protected] with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on [email protected] within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on [email protected] who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on [email protected] within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela