โ† Back to the map
Lesson 5

๐Ÿ† Goals, Score & Game Over

Goals, Score & Game Over illustration

Your hero looks alive, runs, jumps, and grabs coins. But here's a sneaky question: is it actually a game yet?๐Ÿค” Right now you can't win, and you can't lose โ€” you justโ€ฆ mess around.

One small ingredient turns a toy into a real game: rules.

1

The big idea: a game = a goal + rules

A toy is something you just play withโ€” fun to poke at, but there's no winning or losing. A game adds two magic rules: something to reach (a goal โ€” like โ€œcollect 3 coinsโ€) and something to avoid(a danger โ€” like โ€œdon't touch the spikesโ€).

Every loop, the game quietly checks both: โ€œdid I win yet?โ€ and โ€œdid I just lose?โ€ Those two little questions are what make your heart race. And the best part โ€” you get to decide what the rules are.

2

Your turn: make it winnable (and losable)

Set how many coins win the game, then play. Touch the spikes and it's Game Over; hit your goal and You Win. Try flipping Danger off to feel the difference between a toy and a game.

โญ 0 / 3

Click the game, then โ† โ†’ move, โ†‘ / Space jump. Grab coins, dodge the spikes!

๐ŸŽฏ The goal

How many coins to win? You decide the rule!

collect 3 coins to win

Danger ON โ†’ a real game. Reach the goal AND avoid the spikes.

โ–ธ๐Ÿ”ง Peek inside: โ€œwinโ€ and โ€œloseโ€ are if/then rules

The win and lose checks have a name programmers use constantly: if/then. Every loop the game asks two yes-or-no questions: IF the score reached the goal, THEN you win, and IF the hero touched the spikes, THEN it's game over. An if/then is a little fork in the road โ€” the game looks at what's true right now and picks what happens next. They're everywhere: in your jumps, your coins, your enemies, all of it.

3

Discovery missions

Try each one, tick it off, then peek at the secret.

0/5
  • ๐ŸงธTurn Danger OFF and play. Can you win? Can you lose? Does it still feel like a GAME?

  • ๐ŸŽš๏ธSet โ€œcoins to winโ€ to 1 and play. Then set it to 5 and play again. What changed?

  • ๐Ÿ’ฅWalk straight into the spikes on purpose. What pops up?

  • ๐Ÿ†Now actually win โ€” collect enough coins to hit your goal.

  • ๐Ÿฆ˜There are coins on the far side, past the spikes. Figure out how to safely get them.

๐ŸŒŸ You leveled up! You now know:

๐ŸŽฌ Behind the scenes โ€” what's next?

Your spikes are dangerousโ€ฆ but they just sit there. The scariest part of most games is danger that moves โ€” baddies that wander, or even chase you! Next, we give an enemy its very own little brain. ๐Ÿ‘พ๐Ÿ‘‡

๐Ÿ‘พNext stop ยท Lesson 6Enemies & Simple AI โ†’Give your game baddies that move, chase, and keep things exciting.
โ† Back to the map