1. Scratch: Making a simple game.
STEP 1
Choose a background and character.
Click on stage and Backgrounds tab and either import one of the Scratch backgrounds provided or paint your
own. In this example the default Underwater background is used.
Delete the cat by right-clicking and selecting “delete”, and either create your own character or import one of the
Scratch characters.
Feel free to edit the character to make it look like what you want
Move the character with arrow keys. Add the following script to move character each time the keys are pressed.
The important new block is the ‘Point’ block. Click on the ‘Always face left/right’ or Do not rotate if the
character should not flip around when moving.
2. STEP 2
Add a new sprite (the food) for the character to catch/eat.
In this example a small yellow circle (a simple gold coin) is created and named ‘food’.
Set position of character and food, have food disappear when eaten, have character indicate it ate the food.
Set position of food using the xy cordinates. Have it disappear or be eaten when touched by the character.
The following script shows how to set the coordinates of the food and have it disappear when the character
(yellowfish) touches it. It uses the Hide/Show in the Looks blocks.
It also broadcasts a message ‘eaten’ that the fish will use to change or say something when it eats food.
Script for the food is as follows
Script to add to the yellow fish (YOUR MAIN CHARACTER) along with the arrow keys movement scripts is
3. STEP 3
Each time the game is played (the green flag is clicked) the food is always in the same place. Instead of picking
the x,y coordinates, let the computer pick it randomly, by using random numbers.
See updated script for food. In this it also hides and reappears after waiting second at a different place.
Use the broadcast message (food is eaten) to change the fish, example below shows fish getting bigger, and
changing color. In this case it is necessary to reset the fish to original. See below on changing fish on broadcast
and resetting on green flag.
4. STEP 4
Create a new sprite; and ENEMY sprite! Use scripts similar to that of food to create an enemy, example the
shark. After the shark waits and touches the fish, it can broadcast a message to tell that the game is over. The
Game Over sprite can then listen for this message and show itself and stop the game. In this example, the Shark
also moves slowly around forever in the tank, starting by pointing at a random angle and then bouncing off the
edges.
Create a sprite called GameOver and set it to stop the game when the Shark touches the fish, and the broadcast
message is received. In this example, the Game is also over if time runs out using the wait as a timer.
5. STEP 5 OPTIONAL!!!
If there is a definite way to win the game, example catching all the food (in this example the count of food is
4), then another sprite called YouWin can be used as follows.
In order to count the food caught, create a variable called count and use it as follows in the YouWin sprite.
STEP 6
Now, you want to publish your game to scratch.mit.edu to share and play with others. You can do this from the
main scratch screen.l
Go to Share, and select “share this project online”
Scratch login: cmsdigitalart
Password: cmscougars
Project Name: You choose something appropriate
Project Notes: You can choose to put something appropriate here
Click “OK”
Wait
Click “OK”
Open a web browser and go to scratch.mit.edu (no WWW!”
Login and you should be able to go and see and play your game. Now you can share the URL of your game
with your friends on Tumblr, Facebook, Twitter etc. etc.
TUTORIAL FROM: http://www.digitalartforall.com/790/scratch-making-a-simple-game/