A Battle Room: a classic battle staged in 3D.

Battle

Action Sequences on the Live Map

reactor_fight_stage.js · 1,587 lines · 72 public functions

A Battle Room: a classic battle staged in 3D.

What This Module Does

A battle on the map plays an action through the same sequence player the battle scene uses (ReactorBattleData.Player: branches, waits, concurrent steps, the timeline). This file is the map's side of it: the units are map characters, as 3D models or as sprites, on a 3D map or a flat one.

Classes & Namespaces

Design Notes from the Source Code

A battle on the map plays an action through the same sequence player the battle scene uses (ReactorBattleData.Player: branches, waits, concurrent steps, the timeline). This file is the map's side of it: the units are map characters, as 3D models or as sprites, on a 3D map or a flat one.

The fight (reactor_fight.js) says who acts and lands the result; the stage plays the run:

Stage.begin(run, ctx) true when the stage plays this run Stage.update(ctx) one frame; false when the run has ended Stage.end(run, ctx, interrupted) Stage.isBusy() a unit is still easing back to its cell

Any number of runs play at once, each with its own run object and context. run.rate plays one faster (2: twice as fast); run.side keeps it from the camera.

A unit never leaves its cell: a move step moves where it is drawn (_realX/_realY), and the unit is back on its cell when the run ends. An action no sequence is assigned to plays a built-in one (defaultSequence).

Distances on the grid (mapSequence): a sequence is authored for the battle scene, where the sides stand eight tiles apart. On the map

  • home is the unit's cell;
  • a move to the target stops where the mover's reach meets the target's body (clearance: a weapon's length or an arm's, never inside either body), half the authored standoff when that is farther, and travels at most MAX_TRAVEL tiles; two that already stand nearer than that do not close in: the mover takes half a pace back and strikes from there;
  • a step forward, backward or aside is half as long, along the line to the target rather than across the screen;
  • a screen position means home.

View reactor_fight_stage.js on GitHub · Hide internal (_) functions