My First Scratch Game
Introduction to Software
In this tutorial, we will learn about block-based open source programming software Scratch. You can download the scratch software free of cost and the Scratch online version is also available if you don’t want to download it. Scratch is very easy to use software for learners and hobbyists. You can easily create your games, animations, and interactive stories without any hassle by dragging and dropping blocks. It’s like a puzzle, you don’t need to memorize the syntax and programming languages. By using scratch software students will develop logical thinking, problem-solving skills and express their creativity. The most needed skills in this technology era and parents can also teach coding to their children at home. There are many games in scratch coding that kids can easily develop.
Software at a glance
Code Tab contains Block Palette where you can find blocks that are used to control sprites.
Costume Tab is used to change and draw costumes of sprites or backdrops.
Sound Tab is used to record, import, or edit sounds.
Menu Bar is used to easily access commands that you have to use.
Sprite is a picture or image which you can control from your scripts. Sprites can be used from its library, created by you, or uploaded from your computer.
Stage Size is used to toggle between three stages that are small, regular, and full screen.
The stage is the area where the sprites perform tasks according to your given instructions. You can use background images which are called backdrops.
Blocks are like a puzzle that you can simply drag and drop them below into one another in the scripting area to write your program.
Extension Library is used to add new palettes to the block palette.
The Script is used to perform any task, it’s like a puzzle you can drag and drop block from Block Palette to Scripting Area to write your program.
New Sprite is used to choose a sprite from the library, you can paint on your own, Surprise will select a random sprite from the library.
New Backdrop is used to choose a backdrop from the library, you can paint on your own, Surprise will select a random backdrop from the library.
Create Your First Game
Task: Move your sprite and say Hello! to the audience
Steps to Program your First Scratch Game:
- Open the scratch software
- Select the desired sprite
- Select the desired backdrop
- Program the sprite
Step 1: Open Scratch Software
You can find the Scratch software on your desktop select and press right click.
Now scratch software is opened you can create your first game
Step 2: Select the Desired Sprite
Let’s create our first program. If you want to select a sprite other than the default one you can click on a small cross icon (x) to delete the Scratch Cat.
Hover over your mouse to the blue icon under the stage to select your desired sprite.
Select any sprite you like and press right click to add into your game
Now the sprite is added, your game will look like this
Step 3: Select the Desired Backdrop
The background looks boring so we can select a backdrop. Select backdrop from the blue icon under the stage.
Select the backdrop as you like to create your game more interesting.
Now, the desired backdrop and sprite is already selected and your game will look like this.
Step 4: Program the Sprite
Now, it’s time to program your first game
After changing the backdrop click on the sprite to write its script so the sprite should move. Follow these simple steps
- Go to Motion blocks palette drag and drop move (10) steps block in scripting area. This block will move the sprite you can write any number so that the sprite will move those defined number of steps.
- To continuously move your sprite you need to add a forever block. To add a forever block open the Control blocks palette drag and drop forever block and move 10 steps block inside forever block.
- We need a block to start the script, go to the Event blocks palette and add when the flag clicked block into the scripting area and attach the forever block.
- Now, click on the green flag above the top right corner of the stage you’ll see the sprite will move continuously but after sometimes moves out of sight.
- To resolve this issue go to Motion blocks palette and add if on edge, bounce block below move (10) steps.
- Now click again on the green flag you’ll notice when the sprite touches the edge it bounces back but wait a minute it’s rotation is upside down.
- So we need another block to correct its position. Go to the Motion blocks palette and connect the set rotation style (left-right) block below if edge, bounce block. Now again run the script and check whether your program is now working perfectly or not.
- But your sprite seems still, it doesn’t look like it is moving, so we need a block from Looks block palette and add next costume block below set rotation style (left-right) block.
- Say Hello! to the audience we need to add a say (Hello!) for (2) seconds block from the Looks blocks palette and connect below to the next costume block. You can change the text and seconds if you want. We will change 2 seconds to 0.1 seconds otherwise your sprite will move very slowly.
- Your program is almost completed but whenever you click on the green flag the sprite starts moving from the position where it stops. To start your sprite from a particular position you need to add go to x , y block from Motion blocks palette above forever block and change x to -190 and y to -30.
- Now your first scratch game is completed and it’s time for some action click on green flag your script start glowing which indicating that your program is running.
That’s it you have successfully written a code to move your sprite and say Hello! to the audience.