MeleeAttack

Inherits: Area2D < CollisionObject2D < Node2D < CanvasItem < Node < Object

A Class that can cause damage to any Entity inside a certain area. Suited (but not limited) to close-range or Melee attacks.

This node is Frame-Synced.

Properties

DAMAGE_MODE

Mode

float

Damage

0.0

float

Multiplier

1.0

bool

Cooldown

false

int

obstruction_layers

1

String

FS_Animation

""

int

FS_Hit_Frame

0

AudioStreamPlayer2D

AUX_On_Animation_Start

AudioStreamPlayer2D

AUX_On_Hit_Frame

Entity

parent

get_parent()

RayCast2D

ray

<unknown>

bool

attacking

false

Methods

void

_ready()

void

_process(delta: float)

bool

obstruction_check(target: Entity)

void

damage(amount: float = <unknown>)

void

damage_first(amount: float = <unknown>)

void

damage_closest(amount: float = <unknown>)

void

damage_all(amount: float = <unknown>)

void

damage_distributed(amount: float = <unknown>)


Signals

attacked() 🔗

Emitted when the attack is activated.


hit(entity: Entity, damage_amount: float) 🔗

Emitted when an Entity gets hit by the attack.


Enumerations

enum DAMAGE_MODE: 🔗

DAMAGE_MODE FIRST = 0

Damage only the first Entity in the order in tree.

DAMAGE_MODE CLOSEST = 1

Damage only the Entity whose center is physically closest.

DAMAGE_MODE ALL = 2

Damage all Entity within the area with the full Damage.

DAMAGE_MODE DISTRIBUTED = 3

Distributes the Damage equally to all Entity within the area.


Property Descriptions

DAMAGE_MODE Mode 🔗

The selected DAMAGE_MODE.


float Damage = 0.0 🔗

The default damage amount.


float Multiplier = 1.0 🔗

A multiplier to increase applied damage exponentially.

Useful for power-ups.


bool Cooldown = false 🔗

Cooldown to temporarily disable Frame-Sync.


int obstruction_layers = 1 🔗

All Layers which will block this attack.


String FS_Animation = "" 🔗

Name of the Animation which will automatically trigger this attack.


int FS_Hit_Frame = 0 🔗

Frame at which the damage is applied.


AudioStreamPlayer2D AUX_On_Animation_Start 🔗

AudioStreamPlayer2D to play when the attack animation begins.


AudioStreamPlayer2D AUX_On_Hit_Frame 🔗

AudioStreamPlayer2D to play when the hit frame is reached and damage is applied.


Entity parent = get_parent() 🔗

The parent of this node.


RayCast2D ray = <unknown> 🔗

The RayCast2D used to check for obstructioncs.


bool attacking = false 🔗

A boolean to tell whether the attack is currently in progress or not.


Method Descriptions

void _ready() 🔗

There is currently no description for this method. Please help us by contributing one!


void _process(delta: float) 🔗

There is currently no description for this method. Please help us by contributing one!


bool obstruction_check(target: Entity) 🔗

Checks whether anything in between is blocking the attack.


void damage(amount: float = <unknown>) 🔗

Applies damage based on the selected DAMAGE_MODE.


void damage_first(amount: float = <unknown>) 🔗

Applies damage to only the first Entity in the order in tree.


void damage_closest(amount: float = <unknown>) 🔗

Applies damage to only the Entity whose center is physically closest.


void damage_all(amount: float = <unknown>) 🔗

Applies damage to all Entity within the area with the full Damage.


void damage_distributed(amount: float = <unknown>) 🔗

Applies equally distributed damage to all Entity within the area.

The sum of all damages is equal to amount, which by default is Damage * Multiplier.