How to Play

Write JavaScript in the editor to control the hero in a dynamic world. Define an update() function that runs every 100ms when you click "Run Code." Use "Stop" to pause.

Commands (with Cooldowns)

Advanced Features

Create continuous logic:

function update() {
  if (hero.position.x < portal.position.x) console.log("move 5");
  if (enemies.length > 0 && hero.inventory.potions > 0 && hero.health < 50) console.log("heal 20");
}
    

Key variables:

Task:

Health: 100 | Score: 0 | Potions: 0

Cooldowns: Jump: Ready | Sword: Ready | Bow: Ready | Bomb: Ready | Heal: Ready


Output: