Skip to content
ExploreMapGamesStoriesComicsVideosStudioPrintablesCode LabJourneys
By age โ–พ
  • ๐Ÿงธ Tiny Explorers2โ€“5
  • ๐Ÿฆ‰ Curious Learners6โ€“8
  • ๐Ÿ”ญ Young Investigators9โ€“12
  • ๐Ÿš€ Trailblazers13โ€“17
๐Ÿ‘คParent sign in
Kids Amazing World

A creative learning playground. No ads, no tracking, no chat. Every item is reviewed before it appears.

Explore

  • Explore
  • Learning journeys
  • Surprise me
  • Parent planner

For grown-ups

  • Child safety
  • Privacy
  • Terms (draft)
  • Free & Premium
  • Parent sign in

About this content

Some items in this build are placeholders written for development. Third-party resources are only listed with permission, a license, or an official embed.

โ† All game tutorials

๐Ÿงบ Catch the Stars

Move the basket and catch the falling stars.

How to playYour functionsSettings you can changeStep by stepIdeas to tryLessons

๐ŸŽฎ How to play

Reach the goal score before you run out of lives. Stars you catch earn points; stars that hit the floor cost lives.

  • โ—€ โ–ถ buttons, or the โ† โ†’ arrow keys: Move the basket left and right.

โš™๏ธ Your functions

You write these functions. The game calls them when something happens.

  • onCatch()

    Runs every time a star lands in your basket.

    function onCatch() {
      score = score + 1;
    }
  • onMiss()

    Runs every time a star hits the floor.

    function onMiss() {
      lives = lives - 1;
    }

๐ŸŽš๏ธ Settings you can change

Variables at the top of your code are the game's settings. Change a value, press Play, and see what happens.

player = "๐Ÿงบ"
The emoji you move (any emoji works).
item = "โญ"
The emoji that falls from the sky.
goal = 10
Reach this score to win.
lives = 3
Misses you are allowed. At 0 the game is over.
speed = 2
From 1 (slow) to 5 (fast). You can change it while playing!
score = 0
Your points. The game starts it at 0 and you change it in your functions. set by the game

๐Ÿชœ Step by step

Each step shows code you can add to the end of your game's code. A function or variable written later replaces the earlier one, so you never have to delete anything.

  1. 1Play the starter

    Press Play and catch a few stars. Every catch runs onCatch, and score = score + 1 adds one point. Every miss runs onMiss and takes a life.

    function onCatch() {
      score = score + 1;
    }
  2. 2Make stars worth more

    Change the number you add. Now every star is worth 5 points.

    function onCatch() {
      score = score + 5;
    }
  3. 3React with if

    Use if to change the game when something happens. Here, once your score reaches 8 the game jumps to speed 4. The sign >= means "bigger than or equal to".

    function onCatch() {
      score = score + 1;
      if (score >= 8) {
        speed = 4;
      }
    }
  4. 4Keep a counter

    A counter variable remembers how many you have caught. The % sign gives the remainder after dividing, so catches % 3 === 0 is true on every 3rd catch. Those get a +5 bonus.

    let catches = 0;
    
    function onCatch() {
      catches = catches + 1;
      score = score + 1;
      if (catches % 3 === 0) {
        score = score + 5;
      }
    }
  5. 5Misses that slow you down

    A miss can change any variable, not just lives. Here a miss costs a life and slows the game down, but Math.max keeps the speed from going below 1.

    function onMiss() {
      lives = lives - 1;
      speed = Math.max(1, speed - 1);
    }
Show the full starter code
// ๐ŸŽฎ Catch the Stars!
let player = "๐Ÿงบ";   // the thing you move
let item = "โญ";       // what falls from the sky
let goal = 10;         // reach this score to win
let lives = 3;
let speed = 2;        // 1 (slow) to 5 (fast)

function onCatch() {
  score = score + 1;
}

function onMiss() {
  lives = lives - 1;
}

๐Ÿ’ก Ideas to try

  • Make a game about catching pizza ๐Ÿ• with a plate ๐Ÿฝ๏ธ as the player.
  • Give the player 5 lives, but make misses cost 2 points as well.
  • Start slow and make the game faster every 3 stars.
  • Make the goal 50 and add a bonus for every 10th catch.

Tips

  • Change one thing at a time, then press Play to see what happened.
  • If your code has a mistake, the game shows the line number so you can find it fast.

๐ŸŽ“ Lessons for this game

  • ๐ŸŽฎYour first gameFree
  • ๐Ÿ’ฏScore more pointsFree
  • โค๏ธLives and dangerFree
  • ๐Ÿš€Level up with ifFree
  • ๐Ÿ”’Bonus starsPremium
  • ๐Ÿ”’Danger zonePremium

๐Ÿ› ๏ธ Make your own Catch the Stars game

Game Studio and the full lessons are part of Premium. You can try a free lesson first.

See PremiumTry a free lesson
๐Ÿ”จ Whack-a-Mole โ†’