The core EightBittr engine works on a "tick" interval: every few milliseconds, a standardized series of game actions take place.
Game logic for ticks is defined by the member functions the Frames section, and are run in order:
advance: Any scheduled TimeHandlr events are firedmaintain: Groups are updated for velocities and pruned.setQuadrants: Actors in each Quadrant are recalculated for their new positionsrunCollisions: Collision detection is run with the fresh Quadrant dataupdateCanvas: Updated visuals are drawn to the canvas
Inheriting classes can extend these functions per normal section semantics.
For example, a class may want to add maintain logic for its players on each tick.
export class Frames<Game extends MyGame> extends EightBittrFrames<FullScreenSaver> {
// 2. Groups are updated for velocities and pruned.
public maintain() {
super.maintain();
this.game.players.forEach(this.game.maintenance.maintainPlayer);
}
}