๐ Goals, Score & Game Over

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.
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.
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.
Click the game, then โ โ move, โ / Space jump. Grab coins, dodge the spikes!
๐ฏ The goal
How many coins to win? You decide the rule!
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.
Discovery missions
Try each one, tick it off, then peek at the secret.
๐งธ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:
- ๐งธ A toy just moves. A game has a goal and rules.
- ๐ฏ A win condition: reach the goal (enough score) โ You Win.
- ๐ฅ A lose condition: touch the danger โ Game Over.
- ๐ The game checks both rules every single loop.
- ๐๏ธ Those rules are yours to invent โ that's game design.
๐ฌ 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. ๐พ๐