Scripting your game

Gameplay is plain JavaScript in your project's Scripts/ folder. Attach a script to any object (Inspector › Add Component… › Script); edits reload live while you play, with no rebuild. Ready-made kits cover the common pieces: health, enemies, pickups, doors, checkpoints, a sword, a chest, a fast-travel point.

// A coin: spins, and gives the player one coin when touched.
function onTick(self, dt) { self.rotation = [0, (self.rotation[1] + 90 * dt) % 360, 0]; }
function onEnter(self, other) {
  if (!other.has('player')) return;
  game.sound('2d:coin', self.position);
  game.hud('Coins', String((globalThis.coins = (globalThis.coins || 0) + 1)));
  self.destroy();
}

The full scripting reference (every object, game and input call) is in Help › Scripting Reference.

Arcwright Beta 2 (0.4.0) · generated from the engine source (25e375c86)Something wrong or missing? Tell us
Download Arcwright free