Attack Node Class Overview

The AttackNode is a base class responsible for managing attack actions for any entity that can execute attacks, typically through an attack state. This class can be instantiated by any enemy or entity that performs attacks and provides core functionality for handling damage, knockback, and attack range.

Functions:

init(_enemy, _attack_state)

  • Parameters:
    • _enemy: The entity (enemy, boss or character) executing the attack.
    • _attack_state: The current state of the attack execution.
  • Description: Initializes the AttackNode with the entity and attack state, configuring the base damage and knockback based on the entity’s hitbox.

enter()

  • Description: Called when the attack begins. This function temporarily updates the entity’s hitbox damage and knockback strength based on the attack’s multipliers. It also sets these values in the entity's attack hitbox, making it active.

exit()

  • Description: Called when the attack ends. It restores the entity's hitbox damage and knockback strength to their base values, deactivating the attack hitbox.

Class Properties:

  • attack_state: The current state of the attack (e.g., charging, executing, finishing).
  • attack_name: The name of the attack being performed (empty by default).
  • base_damage: The base damage that the entity can inflict with its attack.
  • base_knockback: The base knockback strength of the attack.
  • damage_mp: A damage multiplier applied to the attack (default is 1.0).
  • enemy: The entity performing the attack.
  • attack_range: The range of the attack, which determines how far the attack can reach.
  • telegraph_anim_name: The name of the animation that plays before the attack executes.