What is a game?
Whether it’s a simple game of hopscotch or a board game like Chess, all games share similar criteria. Firstly, every game has a certain set of rules that must be followed. Without a set of instructions to follow, a person would not be able to understand how to play the game. The second component in which all games share is that there is always a goal in every game. The objective in each game, which is to win, must be measurable by some sort of scoring mechanism. Lastly, all games involve interaction between a person, usually referred to as the “player”, and the game.
What is a video game and how do we interact with video games?
A video game shares the same criteria as any game would. The major difference, however, is that a video game is played electronically. A video game lets the player interact with a digital display, which can come in the form of a television, computer, mobile phone, or gaming platform such as a Playstation, Xbox, etc. The display can receive input devices which the player can use to interact with, such as a mouse, keyboard, touchscreen, or game controller.
Why do video games exist?
Games, in general, exist as a form of entertainment and enjoyment. We play games to stimulate our minds and to challenge our way of thinking. Video games have expanded our definition and platform of gaming, enabling us to make games more and more complex. Video games are easily accessible with an electronic device, and will only continue to expand.
How can I make a video game?
This activity will teach you how to make a simple catch game with the help of Scratch.
What do you control in a game of ‘catch’?
What don’t you control?
What is Scratch?
Scratch is a free programming language and program that was developed by Massachusetts Institute of Technology. There is also an online community where you can create your own interactive stories, games, and animations.
Instructions to Make Your Game:
Enter the website on your computer and follow our simple tutorial so you can start making your own catch game on Scratch! Scratch Tutorial
1. Choose an Object to Fall Down
In order to implement a simple catch game, we’ll need to add some characters and objects to our game. In scratch, these are called “sprites”.
How to add a sprite?
First, go to the sprite library and click on your desired character.
Fig.1: How to go to the sprite library. (Tip: If you don't want the cat in your project, you can delete it using the scissors tool.
Fig.2 : Where to find the scissors tool.
Fig.3 : Sprite library choosing an object
In this particular example, the sprite is a fish.
2. Choose a Backdrop
The next element we need in our game is a backdrop. In Scratch, there are various types of backdrops you can choose from.
How to add a backdrop?
Click on the backdrops library. You can choose any backdrop you want in the
backdrop library as shown below:
Fig.4: Backdrop library.
When you choose a backdrop, it should look like this:
Fig.5: Choosing Backdrop and the falling object.
3. Adding a Catcher at the bottom of the backdrop
Choose a catcher from the same library you used to choose the falling object.
Fig. 15: Adding a catcher.
Tip: Adjust the size of the catcher by clicking with the grow or shrink tool:
Fig. 16: ‘Grow’ and ‘Shrink’ functions.
4. Understanding how to make the objects and catcher move
How to add a Script:
The first thing any script needs is a block to kick it off. Click on the ‘Event’ block and drag the first block onto the scripts pane which is gray in color. One rule to always remember: The script for each sprite will be different, and you will have to add the script to its particular sprite by selecting its thumbnail.
What are blocks?
Blocks are puzzle-piece shapes that are used to create code in Scratch.
Series of connected blocks later becomes your script. All the blocks that we use in the script
have special purpose. You can keep track of a particular block in thee code by its color.
Fig. 6: Keep track of your blocks by their colors.
Motion blocks are the blocks that control a sprite’s movement.
are the blocks that control scripts:
if ( ) then — is a conditional block under ‘Controls’ used so that if the condition is true, the blocks inside it will activate.
What is a thumbnail?
Thumbnail is a reduced-size version of sprites, used to help in organizing them.
Fig. 7: Selecting the catcher’s thumbnail.
Fig.8: Where to find the ‘Scripts’ tab.
Fig. 9: Dragging the script to the ‘Scripts pane’.
Telling your sprite object to go to a random position at the top of the screen:
Now comes the ‘Algebra’ part. The ‘random position’ helps you set the object from falling randomly from the top position of the backdrop. Now, You are going to set the ‘y-axis’ as the motion of your falling. As this block reports the falling object’s y position, it can be used when your script needs to know the object’s up and down position. When you combine both ‘random position’ and ‘set y’, the falling object now knows to fall from a random position.
Fig. 10: Understanding the x-axis and y-axis in Scratch.
4. Go to the Top of the “Backdrop”
Now that we have a character and a backdrop set up, we now want them to “come to life”. This is possible through a script in Scratch, which is simply a collection or stack of blocks that determines how sprites interact with each other and the backdrop.
Your script should look like this:
Fig. 11: Script for setting up ‘random position’
5. Making the object fall
Make the object fall by adding these blocks:
6. Getting the falling object back to the top position in the backdrop
Make the object go back to random locations at the top of the backdrop when it reaches the bottom.
The Script looks like this:
Fig. 14: Script for moving the object back to the top of the backdrop.
7. Moving the catcher
Use arrow keys to move your catcher back and forth.
Your script should like this:
Try it! Press the arrow keys to move left and right.
Fig. 17: Moving the catcher back and forth.
8. Catching the object and keeping track of the score
What does the score block do?
It will add a point each time you catch the falling sprite. This will surely enhance the interaction ability of your game.
How to add a variable to count score:
Create a variable for keeping score. A variable is a changeable value recorded
in Scratch's memory. Variables are created with the ‘Make a Variable’ button in the ‘Variables’ palette
shown in the image below:
Go to Data block -> Make a Variable -> Enter a name for the variable -> Press OK
Fig. 18: Creating a variable in Scratch.
Now, select the falling object by clicking on its thumbnail and add a script to catch it.
The final Script should look like this:
Fig. 19: Catching the falling object.
After touching the catcher, it will go back to the top.
Click the ‘Green flag’ to run your script and Click the ‘stop’ sign if you want it to stop.
Fig. 20: ‘Green Flag’ and ‘Stop’ functions.
How to add a winning message:
When you score enough points, display a winning message.
Click the paintbrush tool to draw a new sprite. Then choose “T”, the text tool, to add a winning message like “You won!”. You can choose any fonts, size and color for the message you want!
Fig. 21: Creating a winning message.
Then add the winning script to the winning message sprite. The script will look like this:
Fig. 22: Adding functionality to the winning message.
Fig. 23: The winning message display.
Now that we finished making our very own catch game, you can now use the knowledge you learned to make other games in Scratch. You can even use the ideas you learned in making your game, and apply them to your everyday life! Consider the following questions and answer them briefly: