Class: Enemy

Enemy

new Enemy(x, y, level)

Base class of an enemy. All enemies will extend this class
Parameters:
Name Type Description
x number Initial x position of enemy
y number Initial y position of enemy
level number Initial level of enemy
Source:

Methods

cleanUpMovement()

Gets called after enemy has finished moving
Source:

die()

Kills this enemy, removing the enemy from activeObjects and the gamestage
Source:

doTurn()

Enemy moves towards the nearest player, and then attacks
Source:

getNearestPlayer() → {Player}

Finds the player on the gamestage that is closest to this enemy
Source:
Returns:
The nearest player to this enemy
Type
Player

isWithinMaxDistance() → {Boolean}

Checks whether or not the enemy is within the max distance from a player
Source:
Returns:
Type
Boolean

receiveDamage(attackingObject)

Reduces this enemy's hp by the amount of damage received and updates health bar
Parameters:
Name Type Description
attackingObject Object
Source:

tickActions()

Keeps track of watchedElements and what the enemy should be doing
Source:

turn()

turn code that gets called when it's the enemy's turn
Source: