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

›玩家 API

游戏

  • 概述
  • 目的
  • 游戏玩法
  • 视角
  • 得分
  • 史诗模式
  • Towers

概念

  • 单位
  • 勇士
  • 技能
  • 空格

玩家 API

  • 空间 API
  • 单元 API
  • 转变 API

提示&技巧

  • 一般
  • JavaScript
  • 人工智能
  • 命令行界面

命令行界面

  • Install
  • Options
Translate

空间 API

Whenever you sense an area, often one or multiple spaces (in an array) will be returned. For example, the "feel" sense in the "Baby Steps" tower returns one space:

const space = warrior.feel();

您可以在一个位置上调用方法来收集跟此处位置相关的信息。

Class Methods

以下是可供您使用的各种方法:

space.getLocation():

Returns the relative location of this space as the number of spaces forward and to the right of your position.

返回值

(number[]): The relative location of this space as the offset [forward, right].

space.isEmpty():

确定当前位置是否是空的 (楼梯除外)。

返回值

(boolean): 此空间是否为空。

space.isStairs()

确定当前位置是否是楼梯。

返回值

(boolean): 楼梯是否位于此处空间。

space.isWall()

确定这里否为当前级别的边缘。

返回值

(boolean): 此处空间是否为墙壁。

space.isUnit()

确定此位置是否有单位存在。

返回值

(boolean): 是否有一个单位位于该处位置。

space.getUnit()

返回位于此处位置的单位 (如果有)。

返回值

(单位): 位于此位置的单位或 未定义的-如果没有。

← 空格单元 API →
  • Class Methods
    • space.getLocation():
    • space.isEmpty():
    • space.isStairs()
    • space.isWall()
    • space.isUnit()
    • space.getUnit()
WarriorJS Docs
Docs
PlayerMaker
Community
SpectrumTwitterFollow WarriorJS on Twitter
More
DonateGitHubStar