AURA

JSGG

AuraJS
DOCSEXAMPLESGITHUB
Getting Started 2D
The smallest stable 2D AuraJS game loop and the next docs to read after the first working screen.
docs/external/game-dev-api/getting-started-2d.md

Getting Started 2D

If you are building a 2D game in AuraJS, keep the first version extremely small:

  • one scene
  • one player-controlled object
  • one or two loaded assets
  • one piece of text on screen
  • one sound effect

That is enough to prove your loop, input, rendering, and asset pipeline.

The golden path

For a normal native 2D project, build around:

  • aura.setup for loading assets
  • aura.update(dt) for simulation and input handling
  • aura.draw() for aura.draw2d.*
  • aura.storage for small save data
  • aura.audio for music and SFX

Minimal project shape

Keep your first pass close to this:

assets/
  player.png
  jump.wav
  ui/PressStart2P-Regular.ttf
src/
  main.js
aura.config.json

Minimal 2D loop

let x = 240;
let y = 160;
let speed = 220;
let playerSprite = null;
let uiFont = null;

aura.setup = function () {
  playerSprite = aura.assets.load('player.png');
  aura.assets.load('jump.wav');

  const fontResult = aura.assets.loadFont('ui/PressStart2P-Regular.ttf');
  if (fontResult.ok) {
    uiFont = fontResult.font;
  }
};

aura.update = function (dt) {
  if (aura.input.isKeyDown('arrowleft')) x -= speed * dt;
  if (aura.input.isKeyDown('arrowright')) x += speed * dt;
  if (aura.input.isKeyDown('arrowup')) y -= speed * dt;
  if (aura.input.isKeyDown('arrowdown')) y += speed * dt;

  if (aura.input.isKeyPressed('space')) {
    aura.audio.play('jump.wav', { volume: 0.8, bus: 'sfx' });
  }
};

aura.draw = function () {
  aura.draw2d.clear(aura.rgba(0.08, 0.09, 0.12, 1));
  aura.draw2d.sprite(playerSprite, x, y, { width: 48, height: 48 });
  aura.draw2d.text('MOVE WITH ARROWS', 24, 24, {
    size: 18,
    color: aura.rgba(1, 1, 1, 1),
    font: uiFont || undefined,
  });
};

What to add next

After the first screen works, the usual next layer is:

  1. camera behavior
  2. sprite animation
  3. UI text and menu flow
  4. pickup/impact SFX
  5. save data
  6. transitions and particles

That maps well to the current runtime:

  • load critical assets in setup, not on first use during play
  • keep gameplay state in plain objects and arrays
  • submit draw2d calls only from aura.draw()
  • use one loaded font handle consistently for your UI
  • use aura.assets.getFormatSupport(path) when you are unsure about a file type
  • keep startup music and must-play audio in widely supported formats

Common mistakes to avoid

  • doing draw work in update
  • relying on browser parity when you are building for native
  • using unsupported media formats without checking them first
  • making your first game depend on advanced systems before the loop is fun
DOCUMENT REFERENCE
docs/external/game-dev-api/getting-started-2d.md
AURAJS
Cmd/Ctrl+K
aurajsgg