WarriorJS Docs
  • Player
  • Maker
  • Gemenskap
  • Svenska
    • English
    • العربية
    • Català
    • Čeština
    • Deutsch
    • Ελληνικά
    • Español
    • Français
    • Italiano
    • Polskie
    • Русский
    • Српски језик (Ћирилица)
    • Türkçe
    • 中文
    • 繁體中文
    • Hjälpa till att översätta
  • GitHub

›Player API

Spel

  • Översikt
  • Objekt
  • Spelsätt
  • Perspektiv
  • Poängsättning
  • Episkt läge
  • Torn

Koncept

  • Enheter
  • Krigare
  • Förmågor
  • Rutor

Player API

  • Space API
  • Unit API
  • Turn API

Tips & tricks

  • Allmän
  • JavaScript
  • Artificial Intelligence
  • CLI

CLI

  • Install
  • Options
Translate

Unit API

You can call getUnit() on a space to retrieve the unit located there (but keep in mind that not all spaces have units on them):

const unit = space.getUnit();

You can call methods on a unit to know more about it.

Klassmetoder

Here are the various methods that are available to you:

unit.isBound()

Determines if the unit is bound.

Returns

(boolean): Whether this unit is bound or not.

unit.isEnemy():

Determines if the unit is an enemy.

Returns

(boolean): Whether this is an enemy unit or not.

← Space APITurn API →
  • Klassmetoder
    • unit.isBound()
    • unit.isEnemy():
WarriorJS Docs
Docs
PlayerMaker
Community
SpectrumTwitterFollow WarriorJS on Twitter
More
DonateGitHubStar