API Docs for:
Show:

SpellCasting Class

A component class which allows an entity to cast spells.

Constructor

SpellCasting

(
  • rightCastPointX
  • rightCastPointY
  • friendCollideWith
  • foeCollideWith
)

Parameters:

  • rightCastPointX Number

    The x component of the cast point. The cast point is a position relative to the entity's position from which a spell will be fired. This point is for when an entity casts while facing to the right, the left variant is calculated automatically.

  • rightCastPointY Number

    The y component of the cast point. The cast point is a position relative to the entity's position from which a spell will be fired. This point is for when an entity casts while facing to the right, the left variant is calculated automatically.

  • friendCollideWith Number

    A bit mask used when querying the physics engine for friendly entities.

  • foeCollideWith Number

    A bit mask used when querying the physics engine for enemy entities.

Methods

canCastSpell

(
  • spellName
)
Boolean

Checks whether the spell is ready to be cast again.

Parameters:

  • spellName String

Returns:

Boolean:

getFoeCollideWith

() Number

Returns:

Number:

getFriendCollideWith

() Number

Returns:

Number:

getRightCastPoint

(
  • vector
)

Parameters:

  • vector Vector2D

    Vector to which the cast point will be copied.

getSpellCooldown

(
  • spellName
)
Number

Parameters:

  • spellName String

Returns:

Number: Number of seconds before the spell can be used.

setFoeCollideWith

(
  • foeCollideWith
)

Parameters:

  • foeCollideWith Number

    A bit mask used when querying the physics engine for enemy entities.

setFriendCollideWith

(
  • friendCollideWith
)

Parameters:

  • friendCollideWith Number

    A bit mask used when querying the physics engine for friendly entities.

setRightCastPoint

(
  • rightCastPointX
  • rightCastPointY
)

Parameters:

  • rightCastPointX Number

    The x component of the cast point. The cast point is a position relative to the entity's position from which a spell will be fired. This point is for when an entity casts while facing to the right, the left variant is calculated automatically.

  • rightCastPointY Number

    The y component of the cast point. The cast point is a position relative to the entity's position from which a spell will be fired. This point is for when an entity casts while facing to the right, the left variant is calculated automatically.

setSpellCooldown

(
  • spellName
  • cooldown
)

Parameters:

  • spellName String
  • cooldown Number

    This value needs to be in seconds.