← Choose another age

Ages 10–12

Write your own functions, model characters with objects, and build the logic behind real games.

1

Write Your Own Command

So far you've used commands somebody else wrote. Now you write your own. A function bundles several lines under one name so you can reuse them forever.

Badge: 🏅 Function Author

2

Parameters Make Functions Flexible

A function with no inputs always does exactly the same thing. Parameters turn one function into hundreds of possibilities.

Badge: 🏅 Parameter Pro

3

Functions That Give Answers

Some functions do things; others work something out and hand the answer back with return. Build a function that calculates how far a racer travels.

Badge: 🏅 Return Ranger

4

Objects: Bundle the Facts

A game character has a name, a speed, and a score. Keeping three separate variables gets messy fast — an object keeps related facts together.

Badge: 🏅 Object Architect

5

A Whole Team of Characters

One object is a character. An array of objects is a team, a level, or an enemy wave — the backbone of nearly every game.

Badge: 🏅 Team Coder

6

Short Functions: Arrows

Professional JavaScript is full of little arrow functions — a shorter way to write the same thing, especially when passing a function to another function.

Badge: 🏅 Arrow Coder

7

Game Logic: Keeping Score

Every game needs a score. Collect coins, add points, and check whether the player beat the target — that's game logic.

Badge: 🏅 Score Keeper

8

Collisions: Did They Touch?

Games need to know when two things bump into each other. The trick is comparing positions — if they're close enough, that's a hit.

Badge: 🏅 Collision Coder

9

States: Idle, Running, Sleeping

Game characters live in states. A pet might be idle, then running, then sleeping — and the state decides what it does next.

Badge: 🏅 State Machine

10

Build a Reusable Scene

Good programmers don't repeat themselves. Write one function that builds an entire scene, then call it with different inputs to make different worlds.

Badge: 🏅 Scene Composer

11

Algorithms: Find the Winner

Given a list of scores, how does a computer find the biggest? It checks them one at a time and remembers the best so far. That's an algorithm.

Badge: 🏅 Algorithm Ace

12

Project: Jungle Coin Run

Your final challenge: a mini game. A monkey runs through the jungle, collects coins, dodges rocks, and ends with a win or a crash — all from your code.

Badge: 🏅 Game Maker

Mini projects to try

🎨 Jungle Coin Run🎨 Collision Detection🎨 State Machine🎨 Find the Winner🎨 Reusable Scenes