SCRATCH CODE CHALLENGE Scratch Code SPACE TECH Μαχ Wainewright CRABTREE PUBLISHING COMPANY WWW.CRABTREEBOOKS.COM
Introduction In this book we will look at some key concepts used in space technology and explore them through coding We will find out about gravity and how to deal with it and travel through space We’ll be creating code to simulate how rockets and spaceships move In order to experiment with the effects of gravity we will store the value of gravity in a variable By using a variable to model gravity we will be able to make gravity stronger or weaker to see what effects it has on Earth the Moon and other planets You’ll use the algorithms and ideas in this book along with your imagination to travel through space creating your own programs These programs will help you understand how space technology works and set you on the path to dreaming up your own ideas to travel through the Universe There are a lot of different ways to create code We will be using a website called Scratch to do our coding Type scratch mit edu into your web browser then click Create to start a new project 4
Let’s start by looking at the important parts of the screen in Scratch File Menu for logged-in users If you want you can create an account for free and save your work online Check with a grown-up first Alternatively you can use the Load and Save options to open and save work on your computer Sound Library Add sounds to your program from here All Animals Effects Loops Notes Percussio New Save Now Save as a Copy Go to My Stuff New Load from your computer Upload to your computer Save to your computer Download to your computer Record and Export Video Revert File Menu for general users Choose Load and Save to open and save work on your computer File Edit Tutorials Code Costumes Sounds Block Categories Choose commands from these categories or just scroll through them all Motion move 10 steps turn 15 degrees turn 15 degrees Motion Looks Sound Events Control go to random position Sensing go to x 0 y 0 List of Commands Find the blocks you need by matching the color to the category name For example dark blue blocks will be found in the motion group Operators glide 1 secs to random position Variables glide 1 secs to x 0 y 0 My Blocks point in direction 90 point towards mouse-pointer change x by 10 set x to 0 change y by 10 set y to 0 Sprite Library Choose ready-made sprites for your programs Ballerina-c Ballerina-d Balloon1-a Bananas Baseball Basketball A Bass A Elec Bass A Elec Guitar A Elec Piano A Minor Uk A Piano A Sax A Trombone Scripts Area Add your commands or code here Sprite1 Sprite1 Stage Backdrops The Stage Your program takes place on the Stage Sprites Objects that move around in Scratch are called sprites Sprites Pane Select which of your sprites you want to add code or sound to in this area Code Costumes Sounds costume3 Paint Editor This is where you can draw your own sprites or backdrops Costume Pane Drawing Tools 5