2つの座標が同じか調べる positions.equals
ひとことで言うと
2つの位置が同等かどうかを比較します。
ブロックとコード
~0 ~0 ~0と~0 ~0 ~0が同じ
ブロックの文言は公式の日本語版に合わせています(形は簡易表示です)。
positions.equals(pos(0, 0, 0), pos(0, 0, 0))positions.equals(pos(0, 0, 0), pos(0, 0, 0))引数(ひきすう)
引数とは、ブロックの中で自分で選んだり入力したりする部分のことです。
| 名前 | 選べる値 | 意味 |
|---|---|---|
| p1 | 座標 | 比較する最初の位置 |
| p2 | 座標 | 比較する 2 番目の位置 |
使用例
Teleport the agent to the player if it's not there already.
JavaScript
if (!positions.equals(player.position(), agent.getPosition()))
{
agent.teleportToPlayer()
}Python
if not positions.equals(player.position(), agent.get_position()):
agent.teleport_to_player()