Source: Game_CharacterBase.js

Game_CharacterBase.js

//-----------------------------------------------------------------------------
// Game_CharacterBase
//
// The superclass of Game_Character. It handles basic information, such as
// coordinates and images, shared by all characters.
/**
 * The superclass of Game_Character. It handles basic information, such as coordinates and images, shared by all characters.
 *
 * @class
 * @property {number} x - The x coordinate of the character
 * @property {number} y - The y coordinate of the character
 */
function Game_CharacterBase() {
    this.initialize(...arguments);
}

Object.defineProperties(Game_CharacterBase.prototype, {
    x: {
        get: function() {
            return this._x;
        },
        configurable: true
    },
    y: {
        get: function() {
            return this._y;
        },
        configurable: true
    }
});

/**
 * Initialize the character
 */
Game_CharacterBase.prototype.initialize = function() {
    this.initMembers();
};

/**
 * Initialize character variables
 */
Game_CharacterBase.prototype.initMembers = function() {
    this._x = 0;
    this._y = 0;
    this._realX = 0;
    this._realY = 0;
    this._moveSpeed = 4;
    this._moveFrequency = 6;
    this._opacity = 255;
    this._blendMode = 0;
    this._direction = 2;
    this._pattern = 1;
    this._priorityType = 1;
    this._tileId = 0;
    this._characterName = "";
    this._characterIndex = 0;
    this._isObjectCharacter = false;
    this._walkAnime = true;
    this._stepAnime = false;
    this._directionFix = false;
    this._through = false;
    this._transparent = false;
    this._bushDepth = 0;
    this._animationId = 0;
    this._balloonId = 0;
    this._animationPlaying = false;
    this._balloonPlaying = false;
    this._animationCount = 0;
    this._stopCount = 0;
    this._jumpCount = 0;
    this._jumpPeak = 0;
    this._movementSuccess = true;
};

/**
 * Check if the character's position is equal to the passed coordinates
 *
 * @param {number} x - The x coordinate to check
 * @param {number} y - The y coordinate to check
 * @return {boolean} True if coordinates match
 */
Game_CharacterBase.prototype.pos = function(x, y) {
    return this._x === x && this._y === y;
};

/**
 * Check if the character's position is equal to the passed coordinates, and it's (n)ot (t)hrough
 *
 * @param {number} x - The x coordinate to check
 * @param {number} y - The y coordinate to check
 * @return {boolean} True if coordinates match and the character is not through
 */
Game_CharacterBase.prototype.posNt = function(x, y) {
    // No through
    return this.pos(x, y) && !this.isThrough();
};

/**
 * Get the move speed of the character
 *
 * @return {number} The character's movement speed
 */
Game_CharacterBase.prototype.moveSpeed = function() {
    return this._moveSpeed;
};

/**
 * Set the move speed of the character
 *
 * @param {number} moveSpeed - The character's new movement speed
 */
Game_CharacterBase.prototype.setMoveSpeed = function(moveSpeed) {
    this._moveSpeed = moveSpeed;
};

/**
 * Get the move frequency of the character
 *
 * @return {number} The character's movement frequency
 */
Game_CharacterBase.prototype.moveFrequency = function() {
    return this._moveFrequency;
};

/**
 * Set the move frequency of the character
 *
 * @param {number} moveFrequency - The character's new movement frequency
 */
Game_CharacterBase.prototype.setMoveFrequency = function(moveFrequency) {
    this._moveFrequency = moveFrequency;
};

/**
 * Get the opacity of the character
 *
 * @return {number} The character's opacity
 */
Game_CharacterBase.prototype.opacity = function() {
    return this._opacity;
};

/**
 * Set the opacity of the character
 *
 * @param {number} opacity - The character's new opacity
 */
Game_CharacterBase.prototype.setOpacity = function(opacity) {
    this._opacity = opacity;
};

/**
 * Get the blend mode of the character
 *
 * @return {number} The character's blend mode
 */
Game_CharacterBase.prototype.blendMode = function() {
    return this._blendMode;
};

/**
 * Set the blend mode of the character
 *
 * @param {number} blendMode - The character's new blend mode
 */
Game_CharacterBase.prototype.setBlendMode = function(blendMode) {
    this._blendMode = blendMode;
};

/**
 * Check if the character is normal priority
 *
 * @return {boolean} True if normal priority
 */
Game_CharacterBase.prototype.isNormalPriority = function() {
    return this._priorityType === 1;
};

/**
 * Set the priority type of the character
 *
 * @param {number} priorityType - The character's new priority type
 */
Game_CharacterBase.prototype.setPriorityType = function(priorityType) {
    this._priorityType = priorityType;
};

/**
 * Check if the character is moving
 *
 * @return {boolean} True if moving
 */
Game_CharacterBase.prototype.isMoving = function() {
    return this._realX !== this._x || this._realY !== this._y;
};

/**
 * Check if the character is jumping
 *
 * @return {boolean} True if jumping
 */
Game_CharacterBase.prototype.isJumping = function() {
    return this._jumpCount > 0;
};

/**
 * Get the character's jump height
 *
 * @return {number} The character's jump height
 */
Game_CharacterBase.prototype.jumpHeight = function() {
    return (
        (this._jumpPeak * this._jumpPeak -
            Math.pow(Math.abs(this._jumpCount - this._jumpPeak), 2)) /
        2
    );
};

/**
 * Check if the character is stopping
 *
 * @return {boolean} True if stopping
 */
Game_CharacterBase.prototype.isStopping = function() {
    return !this.isMoving() && !this.isJumping();
};

/**
 * Check if the character should stop
 *
 * @param {number} threshold - The threshold after which the character should stop
 * @return {boolean} True if should stop
 */
Game_CharacterBase.prototype.checkStop = function(threshold) {
    return this._stopCount > threshold;
};

/**
 * Resets the stop count
 */
Game_CharacterBase.prototype.resetStopCount = function() {
    this._stopCount = 0;
};

/**
 * Get the real movement speed for the character (factor in dashing or other effects)
 *
 * @return {number} The actual move speed of the character
 */
Game_CharacterBase.prototype.realMoveSpeed = function() {
    return this._moveSpeed + (this.isDashing() ? 1 : 0);
};

/**
 * Get the distance moved per frame
 *
 * @return {number} The distance moved per frame
 */
Game_CharacterBase.prototype.distancePerFrame = function() {
    return Math.pow(2, this.realMoveSpeed()) / 256;
};

/**
 * Check if the character is dashing
 *
 * @return {boolean} True if dashing
 */
Game_CharacterBase.prototype.isDashing = function() {
    return false;
};

/**
 * Check if the character is in the debug through state
 *
 * @return {boolean} True if debug through
 */
Game_CharacterBase.prototype.isDebugThrough = function() {
    return false;
};

/**
 * Straighten the character
 */
Game_CharacterBase.prototype.straighten = function() {
    if (this.hasWalkAnime() || this.hasStepAnime()) {
        this._pattern = 1;
    }
    this._animationCount = 0;
};

/**
 * Reverse the character's direction
 *
 * @param {number} d - The direction to reverse from
 */
Game_CharacterBase.prototype.reverseDir = function(d) {
    return 10 - d;
};

/**
 * Check if the character can pass a tile in front of them given x/y coordinates and direction
 *
 * @param {number} x - The x coordinate at the start of the move
 * @param {number} y - The y coordinate at the start of the move
 * @param {number} d - The direction of the move
 * @return {boolean} True if can pass
 */
Game_CharacterBase.prototype.canPass = function(x, y, d) {
    const x2 = $gameMap.roundXWithDirection(x, d);
    const y2 = $gameMap.roundYWithDirection(y, d);
    if (!$gameMap.isValid(x2, y2)) {
        return false;
    }
    if (this.isThrough() || this.isDebugThrough()) {
        return true;
    }
    if (!this.isMapPassable(x, y, d)) {
        return false;
    }
    if (this.isCollidedWithCharacters(x2, y2)) {
        return false;
    }
    return true;
};

/**
 * Check if the character can diagonally pass a tile in front of them given x/y coordinates and horizontal/vertical direction
 *
 * @param {number} x - The x coordinate at the start of the move
 * @param {number} y - The y coordinate at the start of the move
 * @param {number} horz - The horizontal direction of the move
 * @param {number} vert - The vertical direction of the move
 * @return {boolean} True if can pass
 */
Game_CharacterBase.prototype.canPassDiagonally = function(x, y, horz, vert) {
    const x2 = $gameMap.roundXWithDirection(x, horz);
    const y2 = $gameMap.roundYWithDirection(y, vert);
    if (this.canPass(x, y, vert) && this.canPass(x, y2, horz)) {
        return true;
    }
    if (this.canPass(x, y, horz) && this.canPass(x2, y, vert)) {
        return true;
    }
    return false;
};

/**
 * Check if the map is passable between two tiles
 *
 * @param {number} x - The x coordinate at the start of the move
 * @param {number} y - The y coordinate at the start of the move
 * @param {number} d - The direction of the move
 * @return {boolean} True if map is passable
 */
Game_CharacterBase.prototype.isMapPassable = function(x, y, d) {
    const x2 = $gameMap.roundXWithDirection(x, d);
    const y2 = $gameMap.roundYWithDirection(y, d);
    const d2 = this.reverseDir(d);
    return $gameMap.isPassable(x, y, d) && $gameMap.isPassable(x2, y2, d2);
};

/**
 * Check if the character collided with other characters
 *
 * @param {number} x - The x coordinate to check
 * @param {number} y - The y coordinate to check
 * @return {boolean} True if collided
 */
Game_CharacterBase.prototype.isCollidedWithCharacters = function(x, y) {
    return this.isCollidedWithEvents(x, y) || this.isCollidedWithVehicles(x, y);
};

/**
 * Check if the character collided with event characters
 *
 * @param {number} x - The x coordinate to check
 * @param {number} y - The y coordinate to check
 * @return {boolean} True if collided
 */
Game_CharacterBase.prototype.isCollidedWithEvents = function(x, y) {
    const events = $gameMap.eventsXyNt(x, y);
    return events.some(event => event.isNormalPriority());
};

/**
 * Check if the character collided with vehicle characters
 *
 * @param {number} x - The x coordinate to check
 * @param {number} y - The y coordinate to check
 * @return {boolean} True if collided
 */
Game_CharacterBase.prototype.isCollidedWithVehicles = function(x, y) {
    return $gameMap.boat().posNt(x, y) || $gameMap.ship().posNt(x, y);
};

/**
 * Sets the position of the character
 *
 * @param {number} x - The new x coordinate
 * @param {number} y - The new y coordinate
 */
Game_CharacterBase.prototype.setPosition = function(x, y) {
    this._x = Math.round(x);
    this._y = Math.round(y);
    this._realX = x;
    this._realY = y;
};

/**
 * Copies the position of another character
 *
 * @param {Game_Character} character - The character to copy position from
 */
Game_CharacterBase.prototype.copyPosition = function(character) {
    this._x = character._x;
    this._y = character._y;
    this._realX = character._realX;
    this._realY = character._realY;
    this._direction = character._direction;
};

/**
 * Locates the character to the given coordinates
 *
 * @param {number} x - The new x coordinate
 * @param {number} y - The new y coordinate
 */
Game_CharacterBase.prototype.locate = function(x, y) {
    this.setPosition(x, y);
    this.straighten();
    this.refreshBushDepth();
};

/**
 * Get the direction of the character
 *
 * @return {number} The character direction
 */
Game_CharacterBase.prototype.direction = function() {
    return this._direction;
};

/**
 * Set the direction of the character
 *
 * @param {number} d - The character's new direction
 */
Game_CharacterBase.prototype.setDirection = function(d) {
    if (!this.isDirectionFixed() && d) {
        this._direction = d;
    }
    this.resetStopCount();
};

/**
 * Check if the character is a tile
 *
 * @return {boolean} True if tile
 */
Game_CharacterBase.prototype.isTile = function() {
    return this._tileId > 0 && this._priorityType === 0;
};

/**
 * Check if the character is an object character
 *
 * @return {boolean} True if object character
 */
Game_CharacterBase.prototype.isObjectCharacter = function() {
    return this._isObjectCharacter;
};

/**
 * Get the amount to shift the character's y value
 *
 * @return {number} Amount to shift the y value by
 */
Game_CharacterBase.prototype.shiftY = function() {
    return this.isObjectCharacter() ? 0 : 6;
};

/**
 * Get the character scrolled x value
 *
 * @return {number} The scrolled x value
 */
Game_CharacterBase.prototype.scrolledX = function() {
    return $gameMap.adjustX(this._realX);
};

/**
 * Get the character scrolled y value
 *
 * @return {number} The scrolled y value
 */
Game_CharacterBase.prototype.scrolledY = function() {
    return $gameMap.adjustY(this._realY);
};

/**
 * Get the character screen x value
 *
 * @return {number} The screen x value
 */
Game_CharacterBase.prototype.screenX = function() {
    const tw = $gameMap.tileWidth();
    return Math.floor(this.scrolledX() * tw + tw / 2);
};

/**
 * Get the character screen y value
 *
 * @return {number} The screen y value
 */
Game_CharacterBase.prototype.screenY = function() {
    const th = $gameMap.tileHeight();
    return Math.floor(
        this.scrolledY() * th + th - this.shiftY() - this.jumpHeight()
    );
};

/**
 * Get the character screen z value
 *
 * @return {number} The screen z value
 */
Game_CharacterBase.prototype.screenZ = function() {
    return this._priorityType * 2 + 1;
};

/**
 * Check if the character is near the screen
 *
 * @return {boolean} True if near the screen
 */
Game_CharacterBase.prototype.isNearTheScreen = function() {
    const gw = Graphics.width;
    const gh = Graphics.height;
    const tw = $gameMap.tileWidth();
    const th = $gameMap.tileHeight();
    const px = this.scrolledX() * tw + tw / 2 - gw / 2;
    const py = this.scrolledY() * th + th / 2 - gh / 2;
    return px >= -gw && px <= gw && py >= -gh && py <= gh;
};

/**
 * Update the character
 */
Game_CharacterBase.prototype.update = function() {
    if (this.isStopping()) {
        this.updateStop();
    }
    if (this.isJumping()) {
        this.updateJump();
    } else if (this.isMoving()) {
        this.updateMove();
    }
    this.updateAnimation();
};

/**
 * Update the character's stop
 */
Game_CharacterBase.prototype.updateStop = function() {
    this._stopCount++;
};

/**
 * Update the character's jump
 */
Game_CharacterBase.prototype.updateJump = function() {
    this._jumpCount--;
    this._realX =
        (this._realX * this._jumpCount + this._x) / (this._jumpCount + 1.0);
    this._realY =
        (this._realY * this._jumpCount + this._y) / (this._jumpCount + 1.0);
    this.refreshBushDepth();
    if (this._jumpCount === 0) {
        this._realX = this._x = $gameMap.roundX(this._x);
        this._realY = this._y = $gameMap.roundY(this._y);
    }
};

/**
 * Update the character's move
 */
Game_CharacterBase.prototype.updateMove = function() {
    if (this._x < this._realX) {
        this._realX = Math.max(this._realX - this.distancePerFrame(), this._x);
    }
    if (this._x > this._realX) {
        this._realX = Math.min(this._realX + this.distancePerFrame(), this._x);
    }
    if (this._y < this._realY) {
        this._realY = Math.max(this._realY - this.distancePerFrame(), this._y);
    }
    if (this._y > this._realY) {
        this._realY = Math.min(this._realY + this.distancePerFrame(), this._y);
    }
    if (!this.isMoving()) {
        this.refreshBushDepth();
    }
};

/**
 * Update the character's animation
 */
Game_CharacterBase.prototype.updateAnimation = function() {
    this.updateAnimationCount();
    if (this._animationCount >= this.animationWait()) {
        this.updatePattern();
        this._animationCount = 0;
    }
};

/**
 * Get the wait between animation frames
 *
 * @return {number} Amount to wait between animation frames
 */
Game_CharacterBase.prototype.animationWait = function() {
    return (9 - this.realMoveSpeed()) * 3;
};

/**
 * Update the animation count
 */
Game_CharacterBase.prototype.updateAnimationCount = function() {
    if (this.isMoving() && this.hasWalkAnime()) {
        this._animationCount += 1.5;
    } else if (this.hasStepAnime() || !this.isOriginalPattern()) {
        this._animationCount++;
    }
};

/**
 * Updates the animation pattern
 */
Game_CharacterBase.prototype.updatePattern = function() {
    if (!this.hasStepAnime() && this._stopCount > 0) {
        this.resetPattern();
    } else {
        this._pattern = (this._pattern + 1) % this.maxPattern();
    }
};

/**
 * Get the maximum pattern for animation
 *
 * @return {number} The maximum pattern for animation
 */
Game_CharacterBase.prototype.maxPattern = function() {
    return 4;
};

/**
 * Get the current animation pattern
 *
 * @return {number} The current animation pattern
 */
Game_CharacterBase.prototype.pattern = function() {
    return this._pattern < 3 ? this._pattern : 1;
};

/**
 * Set the current animation pattern
 *
 * @param {number} pattern - The new current animation pattern
 */
Game_CharacterBase.prototype.setPattern = function(pattern) {
    this._pattern = pattern;
};

/**
 * Check if the pattern is in the original state
 *
 * @return {boolean} True if in original state
 */
Game_CharacterBase.prototype.isOriginalPattern = function() {
    return this.pattern() === 1;
};

/**
 * Resets the animation pattern
 */
Game_CharacterBase.prototype.resetPattern = function() {
    this.setPattern(1);
};

/**
 * Refresh the character for bush depth change
 */
Game_CharacterBase.prototype.refreshBushDepth = function() {
    if (
        this.isNormalPriority() &&
        !this.isObjectCharacter() &&
        this.isOnBush() &&
        !this.isJumping()
    ) {
        if (!this.isMoving()) {
            this._bushDepth = 12;
        }
    } else {
        this._bushDepth = 0;
    }
};

/**
 * Check if the character is on a ladder
 *
 * @return {boolean} True if on ladder
 */
Game_CharacterBase.prototype.isOnLadder = function() {
    return $gameMap.isLadder(this._x, this._y);
};

/**
 * Check if the character is on a bush
 *
 * @return {boolean} True if on bush tile
 */
Game_CharacterBase.prototype.isOnBush = function() {
    return $gameMap.isBush(this._x, this._y);
};

/**
 * Get the terrain tag the character is on
 *
 * @return {number} The terrain tag
 */
Game_CharacterBase.prototype.terrainTag = function() {
    return $gameMap.terrainTag(this._x, this._y);
};

/**
 * Get the region id the character is on
 *
 * @return {number} The region id
 */
Game_CharacterBase.prototype.regionId = function() {
    return $gameMap.regionId(this._x, this._y);
};

/**
 * Increase the character's steps
 */
Game_CharacterBase.prototype.increaseSteps = function() {
    if (this.isOnLadder()) {
        this.setDirection(8);
    }
    this.resetStopCount();
    this.refreshBushDepth();
};

/**
 * Get the character's tile id
 *
 * @return {number} The character's tile id
 */
Game_CharacterBase.prototype.tileId = function() {
    return this._tileId;
};

/**
 * Get the character's name (for character sheet image)
 *
 * @return {string} The character name
 */
Game_CharacterBase.prototype.characterName = function() {
    return this._characterName;
};

/**
 * Get the character's index (for character sheet image)
 *
 * @return {number} The character index
 */
Game_CharacterBase.prototype.characterIndex = function() {
    return this._characterIndex;
};

/**
 * Set the character's image properties (character name and index)
 *
 * @param {string} characterName - The new character name
 * @param {number} characterIndex - The new character index
 */
Game_CharacterBase.prototype.setImage = function(
    characterName,
    characterIndex
) {
    this._tileId = 0;
    this._characterName = characterName;
    this._characterIndex = characterIndex;
    this._isObjectCharacter = ImageManager.isObjectCharacter(characterName);
};

/**
 * Set the character's image properties when it's a tile character
 *
 * @param {number} tileId - The tile id to use for the image
 */
Game_CharacterBase.prototype.setTileImage = function(tileId) {
    this._tileId = tileId;
    this._characterName = "";
    this._characterIndex = 0;
    this._isObjectCharacter = true;
};

/**
 * Check for event trigger touch (in front of character)
 *
 * @param {number} d - The character's direction
 */
Game_CharacterBase.prototype.checkEventTriggerTouchFront = function(d) {
    const x2 = $gameMap.roundXWithDirection(this._x, d);
    const y2 = $gameMap.roundYWithDirection(this._y, d);
    this.checkEventTriggerTouch(x2, y2);
};

/**
 * Check for event trigger touch. Implemented by child classes
 *
 * @return {boolean} When called from Game_CharacterBase, this always returns false
 */
Game_CharacterBase.prototype.checkEventTriggerTouch = function(/*x, y*/) {
    return false;
};

/**
 * Check for movement success
 *
 * @return {boolean} True if movement succeeded
 */
Game_CharacterBase.prototype.isMovementSucceeded = function(/*x, y*/) {
    return this._movementSuccess;
};

/**
 * Set movement success
 *
 * @param {boolean} success - Whether movement succeeded
 */
Game_CharacterBase.prototype.setMovementSuccess = function(success) {
    this._movementSuccess = success;
};

/**
 * Moves straight in the given direction
 *
 * @param {number} d - The direction to move in
 */
Game_CharacterBase.prototype.moveStraight = function(d) {
    this.setMovementSuccess(this.canPass(this._x, this._y, d));
    if (this.isMovementSucceeded()) {
        this.setDirection(d);
        this._x = $gameMap.roundXWithDirection(this._x, d);
        this._y = $gameMap.roundYWithDirection(this._y, d);
        this._realX = $gameMap.xWithDirection(this._x, this.reverseDir(d));
        this._realY = $gameMap.yWithDirection(this._y, this.reverseDir(d));
        this.increaseSteps();
    } else {
        this.setDirection(d);
        this.checkEventTriggerTouchFront(d);
    }
};

/**
 * Moves diagonally in the given directions
 *
 * @param {number} horz - The horizontal direction to move in
 * @param {number} vert - The vertical direction to move in
 */
Game_CharacterBase.prototype.moveDiagonally = function(horz, vert) {
    this.setMovementSuccess(
        this.canPassDiagonally(this._x, this._y, horz, vert)
    );
    if (this.isMovementSucceeded()) {
        this._x = $gameMap.roundXWithDirection(this._x, horz);
        this._y = $gameMap.roundYWithDirection(this._y, vert);
        this._realX = $gameMap.xWithDirection(this._x, this.reverseDir(horz));
        this._realY = $gameMap.yWithDirection(this._y, this.reverseDir(vert));
        this.increaseSteps();
    }
    if (this._direction === this.reverseDir(horz)) {
        this.setDirection(horz);
    }
    if (this._direction === this.reverseDir(vert)) {
        this.setDirection(vert);
    }
};

/**
 * Jumps the character
 *
 * @param {number} xPlus - Amount to jump in the x direction
 * @param {number} yPlus - Amount to jump in the y direction
 */
Game_CharacterBase.prototype.jump = function(xPlus, yPlus) {
    if (Math.abs(xPlus) > Math.abs(yPlus)) {
        if (xPlus !== 0) {
            this.setDirection(xPlus < 0 ? 4 : 6);
        }
    } else {
        if (yPlus !== 0) {
            this.setDirection(yPlus < 0 ? 8 : 2);
        }
    }
    this._x += xPlus;
    this._y += yPlus;
    const distance = Math.round(Math.sqrt(xPlus * xPlus + yPlus * yPlus));
    this._jumpPeak = 10 + distance - this._moveSpeed;
    this._jumpCount = this._jumpPeak * 2;
    this.resetStopCount();
    this.straighten();
};

/**
 * Check if the character has a walk animation
 *
 * @return {boolean} True if has walk animation
 */
Game_CharacterBase.prototype.hasWalkAnime = function() {
    return this._walkAnime;
};

/**
 * Set the character walk animation flag
 *
 * @param {boolean} walkAnime - New walk animation flag
 */
Game_CharacterBase.prototype.setWalkAnime = function(walkAnime) {
    this._walkAnime = walkAnime;
};

/**
 * Check if the character has a step animation
 *
 * @return {boolean} True if has step animation
 */
Game_CharacterBase.prototype.hasStepAnime = function() {
    return this._stepAnime;
};

/**
 * Set the character step animation flag
 *
 * @param {boolean} stepAnime - New step animation flag
 */
Game_CharacterBase.prototype.setStepAnime = function(stepAnime) {
    this._stepAnime = stepAnime;
};

/**
 * Check if the character has a fixed direction
 *
 * @return {boolean} True if has fixed direction
 */
Game_CharacterBase.prototype.isDirectionFixed = function() {
    return this._directionFix;
};

/**
 * Set the character direction fix flag
 *
 * @param {boolean} directionFix - New direction fix flag
 */
Game_CharacterBase.prototype.setDirectionFix = function(directionFix) {
    this._directionFix = directionFix;
};

/**
 * Check if the character is through
 *
 * @return {boolean} True if through
 */
Game_CharacterBase.prototype.isThrough = function() {
    return this._through;
};

/**
 * Set the character through flag
 *
 * @param {boolean} through - New through flag
 */
Game_CharacterBase.prototype.setThrough = function(through) {
    this._through = through;
};

/**
 * Check if the character is transparent
 *
 * @return {boolean} True if transparent
 */
Game_CharacterBase.prototype.isTransparent = function() {
    return this._transparent;
};

/**
 * Get the character's bush depth
 *
 * @return {number} The character's bush depth
 */
Game_CharacterBase.prototype.bushDepth = function() {
    return this._bushDepth;
};

/**
 * Set the transparent flag
 *
 * @param {boolean} transparent - New transparent flag
 */
Game_CharacterBase.prototype.setTransparent = function(transparent) {
    this._transparent = transparent;
};

/**
 * Start the animation
 */
Game_CharacterBase.prototype.startAnimation = function() {
    this._animationPlaying = true;
};

/**
 * Start the character balloon animation
 */
Game_CharacterBase.prototype.startBalloon = function() {
    this._balloonPlaying = true;
};

/**
 * Check if the animation is playing
 *
 * @return {boolean} True if animation playing
 */
Game_CharacterBase.prototype.isAnimationPlaying = function() {
    return this._animationPlaying;
};

/**
 * Check if the character balloon animation is playing
 *
 * @return {boolean} True if balloon animation playing
 */
Game_CharacterBase.prototype.isBalloonPlaying = function() {
    return this._balloonPlaying;
};

/**
 * End the animation
 */
Game_CharacterBase.prototype.endAnimation = function() {
    this._animationPlaying = false;
};

/**
 * End the balloon animation
 */
Game_CharacterBase.prototype.endBalloon = function() {
    this._balloonPlaying = false;
};