Class

Ballistics

Ballistics()

Ballistics handler.
Constructor

# new Ballistics()

Create new Ballistics handler

View Source browser/lib/Ballistics/Ballistics.js, line 11

Classes

Ballistics

Members

boolean

# displayInitialized

Determine whether the weapons HUD has been initialized

View Source browser/lib/Ballistics/Ballistics.js, line 53

number

# frames

frames - counter to control the update frequency for weapon actions

View Source browser/lib/Ballistics/Ballistics.js, line 34

array

# indexesToDelete

indexesToDelete - indexes of various projectile entities to remove

View Source browser/lib/Ballistics/Ballistics.js, line 46

array

# projectiles

projectiles - array of tracked projectiles currently on canvas

View Source browser/lib/Ballistics/Ballistics.js, line 40

Object

# trigger

trigger - determines whether or not the weapon is triggered

View Source browser/lib/Ballistics/Ballistics.js, line 28

Object

# weapon

weapon - the equipped weapon

View Source browser/lib/Ballistics/Ballistics.js, line 22

Methods

# cleanupProjectiles(walls) → {void}

Clean up handled projectiles to stop rendering and updates.
Parameters:
Name Type Description
walls Array.<Wall> the rendered walls

View Source browser/lib/Ballistics/Ballistics.js, line 230

void

# handleFire(context, player) → {void}

Handle weapon fire.
Parameters:
Name Type Description
context CanvasRenderingContext2D the canvas rendering context
player Player the player entity

View Source browser/lib/Ballistics/Ballistics.js, line 112

void

# initializeWeaponsHUD() → {void}

Initialize the weapons HUD.

View Source browser/lib/Ballistics/Ballistics.js, line 134

void

# refillWeaponAmmoClip() → {void}

Refill the curren ammo clip or replenish magazines.

View Source browser/lib/Ballistics/Ballistics.js, line 191

void

# registerProjectiles(context, player) → {void}

Register bullet projectiles for rendering and collision.
Parameters:
Name Type Description
context CanvasRenderingContext2D the canvas rendering context
player Player the player entity

View Source browser/lib/Ballistics/Ballistics.js, line 211

void

# render() → {void}

Render ballistics projectiles. This is called every frame/repaint to render projectiles. Note that projectiles are an animated entities, therefore their x,y coordinates will change on update.

View Source browser/lib/Ballistics/Ballistics.js, line 65

void

# setEquippedWeaponDisplayInformation() → {void}

Set equippred weapon display information e.g. ammo, magazines.

View Source browser/lib/Ballistics/Ballistics.js, line 147

void

# shouldReloadWeaponAmmoClip() → {boolean}

Determine if weapon needs to be reloaded and handle accordingly.

View Source browser/lib/Ballistics/Ballistics.js, line 170

boolean

# update(game) → {void}

Update game ballistics data, handle weapon triggering and projectile cleanup. Checks the weapon state, sets the weapon stats, handles tiggered weapon actions and audio. This is called every frame/repaint.
Parameters:
Name Type Description
game Game the managed game instance

View Source browser/lib/Ballistics/Ballistics.js, line 82

void