Skip to content

Build a third-person platformer ​

Goal ​

Make a floating star course with double jump, air dash, wall slide/jump, coyote time and jump buffering using the third-person controller.

Files you will edit ​

  • src/course.ts
  • src/level.json

Steps ​

  1. Copy templates/platformer. It casts char.hero and supports keyboard, gamepad and touch. Configure its controller in src/course.ts:

    ts
    import { createThirdPersonController } from 'gameable';
    
    const controller = createThirdPersonController(undefined, {
      jumpAction: 'jump',
      dashAction: 'dash',
      coyoteSeconds: 0.12,
      jumpBufferSeconds: 0.14,
      dashSpeed: 14,
      dashSeconds: 0.16,
      dashCooldown: 1,
      wallSlideSpeed: 2,
      wallJumpSpeed: 7,
    });
  2. These options require physics character bodies. Keep features.characters.motion.carry: false so the controller drives travel. Reset the controller in init and after respawning; update it in a system. The template declares named jump/dash actions for all three input families. controller.state.platforming.cooldown is seconds until dash is ready.

  3. Place MovingPlatform, JumpPad, CheckpointVolume, TriggerBox and Star actors in src/level.json. Ferry and LaunchPad add fitted meshes to MovingPlatform and JumpPad; Spinner composes rotatingMovement. Put checkpoint centres above platforms and the kill volume below the course, above scenery. The template counts stars, requires all at the flag and preserves the session best on Retry.

Verify ​

Run npm test and npm run build:guest. Jump twice, dash, wall jump, collect all stars and finish. Fall before and after the checkpoint; verify respawn, continued timing and dash cooldown. Retry restores pickups and keeps best time.

See also ​