Class: Endboss

Endboss()

Represents the Endboss in the game, which extends from MovableObject. This class controls the different states of the Endboss (walking, alerted, attacking, hurt, and dead) as well as its movement and animation intervals.

Constructor

new Endboss()

Creates an instance of Endboss. Loads images, sets the initial position and offsets, and starts the animation.
Source:

Members

IMAGES_ALERT :Array.<string>

Array of image paths for the alert state.
Type:
  • Array.<string>
Source:

IMAGES_ATTACK :Array.<string>

Array of image paths for the attack state.
Type:
  • Array.<string>
Source:

IMAGES_DEAD :Array.<string>

Array of image paths for the dead state.
Type:
  • Array.<string>
Source:

IMAGES_HURT :Array.<string>

Array of image paths for the hurt state.
Type:
  • Array.<string>
Source:

IMAGES_WALKING :Array.<string>

Array of image paths for the walking state.
Type:
  • Array.<string>
Source:

animationInterval :number|null

Reference to the setInterval used for animations.
Type:
  • number | null
Source:

isAttack :boolean

Indicates whether the Endboss is currently attacking.
Type:
  • boolean
Source:

moveInterval :number|null

Reference to the setInterval used for movement while attacking.
Type:
  • number | null
Source:

Methods

animate()

Starts the movement and animation intervals.
Source:

clearIntervals()

Clears any existing movement and animation intervals.
Source:

handleAlertAnimation()

Plays the alert animation.
Source:

handleAnimation()

Determines the current state and plays the corresponding animation: - Dead, Hurt, Attack, Walking, or Alert.
Source:

handleAttackAnimation()

Plays the attack animation.
Source:

handleDeadAnimation()

Plays the death animation and increments the frame index until the animation completes.
Source:

handleHurtAnimation()

Plays the hurt animation and slightly moves the Endboss to the right. Increases the speed only once during the hurt state.
Source:

handleMovement()

Controls the movement logic: - Moves the Endboss to the left if it is attacking. - Stops the interval if the Endboss is dead. - Moves left if not attacking and the itsMove flag is true.
Source:

handleWalkingAnimation()

Plays the walking animation.
Source:

moveEnemie()

Moves the Endboss to the left during an attack. Starts a movement interval if one is not already active.
Source:

resetEnemy()

Resets the Endboss to its initial state and restarts movement and animation intervals.
Source:

resetSpeed()

Resets the Endboss's speed to its default value.
Source:

startAnimationInterval()

Starts the interval that controls the animation logic.
Source:

startMovementInterval()

Starts the interval that controls the movement logic.
Source: