3-31-2020-Scratch

We are using Scratch. CLICK HERE TO OPEN SCRATCH

My friends have a 6 year old son that had to cancel his birthday so he was really sad. I made this game for him as a birthday present.

https://scratch.mit.edu/projects/380756569/

We are going to build our own Item Collection Game.

 

STEP 1

Add 5 Sprites-

  1. A playable Character 
  2. A collection item
  3. An enemy
  4. This Health bar(right click and save to computer)
  5. Text that says a Game Over

You can add Sprites by hovering over the cat head and choosing one of the options.

Choose one in scratch for now. Click the Cat Head or Magnifying Glass. The only one you should Upload is the Health Bar. To make Game Over, click the Paintbrush and use the Costumes Tab to type the letters.

Step 2

Position your Sprites on the Screen. Make them fit better in the game by decreasing their size. Edit the number in Size. Again, you can draw your own characters later.

Move the Health Bar to the Top Right and the Game Over to the Top Middle.

Step 3

We will create the code that makes the player move around.

You drag script into the space. Pay EXACT attention to what the blocks say. Some of them require you to type in numbers or choose options.

Code is divided into colored section. Click the right color to find the script block in that list. Drag it out exactly how I have it.

The second list of scripts require that you put blocks inside each other. Make sure you have the exact same options that I do.

Connect the bigger sections together, stick them all in the Forever, then connect forever to the block above.

If you followed the directions correctly, hit the Green Flag. The arrow buttons let you move the character around.

Step 4

The next script makes the character animate by rotating thru its costumes. The Cat has two costumes.

Step 5

Now we will make a variable. A variable stores information. You will find the orange circle then click the Make a Variable button. Type the word “Health” check the box “For All Sprites” then hit Ok.

The last script of your character will reduce your health if you hit the Enemy Sprite. You may want to rename your Sprites if that helps keeping track of their names.

Step 6

Now we are creating the scripts for your collectible item.

First, click the Collectible to start editing it. Then make a variable called Score.

Then build these scripts. The top script hides the original collectible. The middle script tells the clones (or copies) to show up in random spots. The bottom script tells the game that when you as a player touch the collectible, it increases the score by one and deletes the clone.

The clones won’t spawn just yet. To do that, we need to edit the Stage.

Step 7

This is a pretty simple script. This tells it every 3 seconds to create a clone of the collectible. Make sure you select the right name of the clone.

Step 8

The enemy is the most complicated scripting. Please pay attention to what each block says. 

Click the enemy.

First make two new variables- “Speed” and “last spot”

Make sure to uncheck variable boxes so only Score shows in the Play area.

I don’t expect you to fully understand how they work but these are the scripts you need to make:

To explain-

  1. Sets the Speed and animation of the enemy
  2. Slowly increases speed of enemy
  3. If your health hits 0, the game stops.
  4. This makes the enemy point in the right direction
  5. This makes the enemy move around

Step 9

This script is long but pretty simple. Each costume of the Health bar is a different number of Health. 6 Health is 3 full hearts. 5 Health is 2 and a half hearts and so on. The other script makes sure your Health starts at 6 on every new game.

Step 10

This step is also easy. Select Game Over and then make this script.

Basically it is hidden as long as Health is not zero.

Optional

It’s more fun if these Sprites were designs that you made!

Use Piskelapp.com to design your own sprites.