Skip to content

Fight component documentation

Peter Crew edited this page Jan 19, 2019 · 1 revision

This page covers the FightComponent class, along with all of the FightAnimation classes that can be added.


FightComponent

This component allows an entity to fight with and attack other entities.

Constructor

The constructor takes a single JavaScript object with the following properties:

Name Type Description
damage int The amount of damage that the entity inflicts with each attack.
animation FightAnimation The animation that is carried out during each attack.
biteRange float How far the entity can bite from.
takesRevenge boolean True if the entity fights back after being attacked. A life component is required if this is true.
pauseTime float How long the entity waits between attacks.

Fight animations

The following animations can be added to a fight component to change how the entity carries out attacks.

LungeAnimation

Causes the entity to lunge at its target when attacking. The constructor is empty, e.g. new LungeAnimation().

StingAnimation

Causes the entity to "sting" its target like a bee when attacking. The constructor is empty, e.g. new StingAnimation().

Clone this wiki locally