MATTIE.troopAPI.RuntimeTroop(troopId,, xOffset,, yOffset,) → {MATTIE.troopAPI.RuntimeTroop}

new RuntimeTroop(troopId,, xOffset,, yOffset,) → {MATTIE.troopAPI.RuntimeTroop}

a class that handles adding troops to the current combat at runtime

Parameters:
Name Type Description
troopId, int

the id of the troop this class represents

xOffset, int

screen x offset for entire troop

yOffset, int

screen y offset for entire troop

Members

_sprites

an array of the sprites of the enemies in this troop

localSwitches

any local switches that exist

localVars

any local vars that are set

spriteSet :Spriteset_Battle

the current battle spriteset

Methods

addSpritesToCurrentBattleSet()

add the sprites of this troop to the current battle sprite sheet

despawn() → {MATTIE.troopAPI.RuntimeTroop}

remove the troop from the active battle if it is present

Returns:
MATTIE.troopAPI.RuntimeTroop -

returns itself so that you can chain commands

initialize(troopId,, xOffset,, yOffset,) → {MATTIE.troopAPI.RuntimeTroop}

the initialize method for a runtime troop. This sets up all values we might need.

Parameters:
Name Type Description
troopId, int

the id of the troop this class represents

xOffset, int

screen x offset for entire troop

yOffset, int

screen y offset for entire troop

removeSpritesFromCurrentBattleSet(troop)

remove all sprites associated with the troop from the current battle

Parameters:
Name Type Description
troop MATTIE.troopAPI.RuntimeTroop

setupTroopId()

generate internal troop id for sorting

spawn() → {MATTIE.troopAPI.RuntimeTroop}

spawn the event into the actual game. Until this is called the event is meaningless

Returns:
MATTIE.troopAPI.RuntimeTroop -

returns itself so that you can initialize and spawn in one line if you would like.

sprites() → {Array.<Sprite_Enemy>}

get all sprites associated with this troop

Returns:
Array.<Sprite_Enemy> -

a list of the enemy sprites