Learn to code thefun way with nine real projects for true beginnersAdventures in Coding is written specifically for young people who want to learn how to code, but don't know where to begin. No experience? No problem! This book starts from the very beginning to take you from newbie to app-builder in no time. You'll 'learn by doing' as you build projects designed to help you master fundamental programming skillsand you'll have a great time doing it. These skills form the foundation of any programmer's tool set, and you'll continue to use them as you graduate to other devices and more difficult projects. Each chapter includes a video to help clear up any confusion and make sure youreally understand, so you can keep programming your way through every single project without hitting major roadblocks. If you're ready to start designing your own program, this book will help you get started today.
More and more kids are learning to code, and many schools offer basic programming classes as part of the regular curriculum. This book is structured like a class, starting with the basics and building skill upon skill, making it both a perfect accompaniment to formal instruction and an ideal guide for self-study.
Learn the basic programming skills you'll use everywhereBuild nine fun projects from super-basic to pretty challengingBuild the skills you need to create bigger and better appsWatch video tutorials for extra help and explanations
How many times have you played with an app only to find yourself wishing it had this or that feature? If you learn how to code,you can be the creator of the next big app! But it all starts with that first small project.Adventures in Coding provides all the information you need, so let's get coding!
Introduction 1
What Is Scratch? 1
Who Should Read This Book? 1
What You Will Learn 1
How This Book Is Structured 2
What You Need to Use This Book 2
Conventions 2
Companion Website 3
Contact Us 3
Adventure1
Scratching the Surface 5
Coding Is Everywhere 5
Speaking the Language of Machines 6
Knowing Your Coding Lingo 7
Writing Your First Scratch Program 8
Joining Scratch 8
Meeting Scratch the Cat 11
Moving Scratch Around 12
Connecting Blocks 13
Looping Movements 14
Starting at the Green Flag 16
Bouncing Off the Walls 17
Creating a Sprite 18
Handling Collisions on the Dance Floor 19
Slowing It Down 22
Learning the Scratch Environment 23
Exploring the Scratch Project Editor 24
The Toolbar 24
The Stage 31
The Sprite Pane 32
The Sprite Info Pane 33
The Scripts Area 33
The Block Palette 34
The Costume Pane 35
The Sound Pane 36
Working with Colors and Shapes in Scratch 37
Further Adventures in Coding 37
Adventure2
Where in the World Is Scratch? 39
Setting the Stage 39
Interacting with the Stage 41
Customizing the Backdrop 42
Using a Picture Backdrop 46
Taking a Picture of the Stage 46
Understanding Coordinates on the Stage 47
Taking Center Stage 48
Moving Left, Right, Up, and Down 49
Knowing Your Directions 50
Working with Degrees of Rotation 51
Spinning Sprites 51
Moving a Sprite 54
Stepping 55
Gliding 55
Jumping 55
Creating Random Scratch Art 56
Randomizing Movements 56
Drawing Random Lines 58
Further Adventures in Coding 59
Adventure3
Using Control Blocks 61
Understanding Code Nesting 61
Branching Programs in Scratch 64
The if ( ) then Block 64
The if ( ) then, else Block 65
Boolean Blocks 67
Making Comments in Scratch 69
Standalone Comments 69
Block Comments 71
Looping in Scratch 72
Looping Forever 72
Stopping Loops with the stop ( ) Block 72
Creating a Counting Loop 72
Looping Until a Condition Is Met 73
Waiting 74
Building the Fly Catcher Game 74
Setting the Stage 75
Placing the Frog 76
Adding the HippoFly 77
Scripting the HippoFly 78
Making the Tongue 78
Further Adventures in Coding 81
Adventure4
Using Sensing Blocks 83
Learning the Sensing Blocks 83
Getting and Using Text Input 84
Detecting Key Presses 89
Watching for Mouse Moves 91
Using Timing 94
Sensing Touching and Distance 97
Building the Apple Patrol Game 102
Further Adventures in Coding 105
Adventure5
Using Event Blocks 107
Understanding the Role of Events 107
Working with Key Press Events 109
Using Backdrop Change Events 114
Implementing Sensing and Timing Events 118
Detecting Video Motion 118
Measuring Loudness 118
Waiting for the Right Time 118
Getting Your Message Across 118
Putting on the Big Event 123
Setting the Stages 124
Programming the Ringleader 126
Programming the Ballerina Show 128
Programming the Dinosaur Show 130
Programming the Stage 131
Showing and Hiding Sprites 133
Further Adventures in Coding 136
Adventure6
Variables and Lists 137
Understanding Variable Blocks 138
Variables Have Names 140
Variables Can Display on the Stage 142
Variables Can Change 144
Scratch Variables Are Persistent 146
Scratch Variables Are Big 147
Making Lists 148
Making a List 148
The Ultimate Party Host 151
Introducing the Lists and Variables 152
Asking for Names and Ages 152
Recalling Names and Ages 154
Further Adventures in Coding 158
Adventure7
Using Operators in Scratch 159
Saying Hello to the Operators 159
Doing the Math 161
Addition 161
Subtraction 164
Multiplication 165
Division 166
Coding Logically 168
Operating on Text 170
Combining Text with join ( ) ( ) 170
Finding Letters 172
Getting Text Length 173
Understanding Other Operations 174
( ) mod ( ) 174
round ( ) 174
( ) of ( ) 175
Make a Math Practice Game 176
Programming Different Paths 177
Making the Addition Quiz 178
Making the Multiplication Quiz 181
Further Adventures in Coding 182
Adventure8
Using Graphics and the Pen 185
Creating Art with the Paint Editor 185
Using Bitmap and Vector Graphics 189
Understanding the Bitmap Tools 189
Drawing with the Vector Tools 190
Making Slides 192
Use the Pen to Make a Skywriting Plane 198
Further Adventures in Coding 203
Adventure9
Building Your Own Blocks 205
Making Your Own Blocks 205
Splitting Programs into Custom Blocks 206
Changing Custom Blocks 210
Borrowing Blocks with the Backpack 215
Putting on a Fashion Show 217
Further Adventures in Coding 222
Adventure10
Making and Using Sounds and Music 223
Using Sounds 223
The Sound Library 224
Using the Sound Editor 227
Editing Sounds 228
Recording Sounds 229
Importing Sounds 231
Forming the Scratch Jazz Band 232
Tuning Up Your Instruments 232
Finding a Drummer 233
Playing the Melody 234
Playing Together 237
Singing Along! 240
Further Adventures in Coding 242
Adventure11
Exploring the Scratch Universe 243
Visiting scratch.mit.edu 243
Sharing Your Projects 245
The Scratch Community Rules 249
Remixing Projects 252
Interfacing with the Real World 253
Understanding Electricity 255
Understanding Makey Makey 256
Understanding Conductivity 257
Sensing with the PicoBoard 259
Further Adventures in Coding 261
AppendixA
Installing the Scratch Offline Editor 263
Installing the Scratch Offline Editor on Windows 263
Installing the Scratch Offline Editor to Your Mac Operating System 268
Other Resources 275
AppendixB
Testing Your Programs 277
Practice Proper Planning 277
Ask Other People to Test 278
Look for Possible Invalid Input 279
Use Comments Often 280
Test Early and Often 280
Keep Track of Tests and What Breaks Things 280
Use Custom Blocks 281
Use Sliders for Numbers 281
Keep Learning 282
Keep Practicing 283
Glossary 285
Index 289