Ghost Catcher Simulation

The Goal

Ghosts will continuously appear at the bottom of the screen and float upward. Your job is to click the ghosts before they reach the top!

Each ghost you successfully click earns you 1 point. If a ghost reaches the top of the screen, you lose 1 life. The game ends when you run out of lives.

Step 1: Create Your Variables

First, create two variables:

  • Score

  • Lives

Click on the Stage and add this script:

When Green Flag Clicked

  • Set Score to 0

  • Set Lives to 3

This ensures the game starts with 0 points and 3 lives every time.

Step 2: Create the Ghost Spawner

Click on your Ghost sprite.

Instead of using a single ghost, we'll use clones to continuously generate new ghosts.

Add this script:

When Green Flag Clicked

  • Hide

  • Forever

    • Wait 1.5 seconds

    • Create clone of myself

The original ghost will stay hidden while creating new ghost clones throughout the game.

Step 3: Program Ghost Movement

Now let's tell each ghost clone what to do when it appears.

Add this script:

When I Start as a Clone

  • Go to x: (pick random -200 to 200) y: -180

  • Show

  • Repeat until (y position > 160)

    • Change y by 5

  • Change Lives by -1

  • Delete this clone

This makes each ghost:

  • Spawn at a random position along the bottom of the screen

  • Float upward

  • Remove a life if it reaches the top

  • Disappear afterward

Step 4: Add Ghost Clicking

Finally, let's allow the player to catch ghosts.

Add this script to the Ghost sprite:

When This Sprite Clicked

  • Change Score by 1

  • Start sound Magic Spell

  • Delete this clone

Every time you click a ghost:

  • Your score increases by 1

  • A sound effect plays

  • The ghost disappears

Challenge Ideas

Once your game is working, try adding:

  • Faster ghosts as the score increases

  • Different ghost costumes

  • A game over screen

  • Sound effects and background music

  • Special bonus ghosts worth extra points

Have fun building your Ghost Catcher Game!

Previous
Previous

Does AI Think Like Me?

Next
Next

How To Make a Solar Oven