πŸ’Ž Ruby Collector

Build a simple collect-and-win game.

Learn about sprites, variables, events, collisions and game design.

Step 1: Create the Game World

🎯 Goal: Create the player, ruby, enemy and score system.
  1. Choose a background.
  2. Create a ruby sprite and set its size to 30.
  3. Create an enemy sprite and set its size to 80.
  4. Make the enemy wander around.
  5. Create the player sprite and set its size to 50.
  6. Make the player move with the arrow keys.
  7. Show a message: β€œCollect 10 rubies to win!”.
  8. Show the score variable and set it to 0.

Variables

VariablePurpose
scoreTracks how many rubies the player has collected.
βœ… You should see a player, a ruby, an enemy and a score counter.

Step 2: Collect Rubies

🎯 Goal: Increase the score when the player touches a ruby.
  1. Create a loop that checks if the player touches the ruby.
  2. Play a collection sound.
  3. Move the ruby to a random location.
  4. Increase score by 1.
  5. If score equals 10, trigger the win event.
  6. Remove all sprites and play a victory sound.

What Does This Code Do?

Every time the player collects a ruby, the ruby jumps somewhere new and the score increases.

πŸ’‘ Random locations make the game more fun because the player must keep searching.
βœ… The score should increase every time a ruby is collected.

Step 3: Create the Game Over Event

🎯 Goal: End the game when the player touches the enemy.
  1. Create a collision event between the player and enemy.
  2. Remove all sprites.
  3. Play a game over sound.
  4. Show the score variable.

Why Are We Doing This?

The enemy creates a challenge. Players must collect rubies while avoiding danger.

βœ… Touching the enemy should immediately end the game.

πŸŽ‰ Congratulations!

You built a complete game with:

  • Variables
  • Sprites
  • Events
  • Collisions
  • Score Tracking
πŸ†