Skip to main content
Annual billing

ThreeJS.net annual plans cost about 50% less than 12 monthly payments

Save

Lantern Town

A third-person Three.js game template: walk, jump, light every lantern

About this scene

An origami fox in a toy harbour town. Walk with WASD or the touch stick, jump with Space, and light all twelve lanterns to set off the fireworks; drag to turn the camera. Until you press a key the fox plays by itself, so the page never looks empty. It is a complete, small game loop in one HTML file: input, movement with easing, collisions, a follow camera, objectives, a HUD and a win state, ready to be reshaped into your own game.

How it is built

  1. 01

    One loop, fixed order

    Each frame reads input, eases the velocity toward the wish, moves, resolves collisions, animates the fox, checks objectives and finally moves the camera. Keeping that order is what makes a small game feel solid.

  2. 02

    Collisions without a physics engine

    Houses, trees, posts and the fountain are axis-aligned boxes on the ground plane. If the fox overlaps one, it is pushed out along the shorter overlap, which slides it along walls instead of stopping it.

  3. 03

    Make it yours

    Swap the fox for your character, the lanterns for coins or quests, and the town for your level. In the studio you can ask for it in plain words: more levels, enemies, a timer race or a different art style.

Questions

Does it work on phones?
Yes. On touch screens it shows a virtual stick and a jump button, and the camera pulls back on portrait screens.
Which engine does it use?
Only three.js r187 and a few lines of game code: no physics engine and no asset files. That keeps it easy to read and quick to load.
How do I turn it into my own game?
Press "Remix in the studio" and describe the game you want. The generator keeps the loop, input and camera, and rewrites the level, character and goals.

More examples