Class: Character

Container for all information about a character in a battle. There are actually 12 subclasses for this, one for each character, but the subclasses are omitted in this documentation. The only special case is that Vega has a hasClaw property which represents whether or not he has his claw (it falls off randomly based on how much damage he takes). Otherwise the subclasses are just a mechanism for inheriting the properties described below.

Properties

animationName {string}

The current animation of this character. This can sometimes be undefined if the animation isn't recognized, but that should be considered a bug in the API.

animationFrame {number}

The current animation frame number.

health {number}

Amount of health remaining. When this hits 0 the battle is over.

healthMaximum {number}

Starting / maximum health. This is always 144.

flipX {boolean}

This is true if the player is facing right. All hitbox data is defined with the player facing left. When the player is facing right the hitbox data should all be flipped horizontally using the flipX() method on Rect or Hitbox. Be sure to call flipX() before calling translate() otherwise your hitbox data will be wrong.

isDizzy {boolean}

If the player is currently dizzy.

isJumping {boolean}

If the player is current jumping.

position {Point}

Current player position. Used for hitbox calculations.

positionUnclipped {Point}

Current position with sub-pixel accuracy.

roundsWon {number}

How many rounds this player has won during this battle.

spritePtr {number}

A value which uniquely identifies the current sprite drawn for this character. This probably isn't very useful.

score {number}

Current score for this player.

throwableBox {Rect}

This box is used for throw detection.

trajectory {AnimationTrajectory | GeometricTrajectory}

While jumping and during certain attacks the player's position will be fairly predictable for a certain period of time. See type documentation for more information.

distanceOffset {number}

Offset from position used for distance calculations. Many attacks have both a "close" and "far" version, this number is used to help determine which attack will be performed. Larger characters have a higher distanceOffset. Distance is calculated with the equation:

distance = Math.abs(player.position.x - opponent.position.x) - player.distanceOffset - opponent.distanceOffset;
projectiles {Array.<Projectile>}

Array of active projectiles belonging to this player.