画面にタイトルを表示する gameplay.title
ひとことで言うと
選択したターゲットのタイトルとサブタイトルを表示します。
ブロックとコード
@aにタイトル"Title"サブタイトル"Sub title"を表示する
ブロックの文言は公式の日本語版に合わせています(形は簡易表示です)。
gameplay.title(mobs.target(ALL_PLAYERS), "Title", "Sub title")gameplay.title(mobs.target(ALL_PLAYERS), "Title", "Sub title")引数(ひきすう)
引数とは、ブロックの中で自分で選んだり入力したりする部分のことです。
| 名前 | 選べる値 | 意味 |
|---|---|---|
| target | ターゲットセレクター | 選択するプレイヤーとエンティティ |
| title | 文字列 | 表示する大きなタイトル |
| subTitle | 文字列 | 表示するサブタイトル |
使用例
In the treasure mini-game below, a diamond is placed randomly around the current positions. All players are then teleported to the location and shown a message to start looking for the diamond.
JavaScript
player.onChat("hunt", function () {
blocks.place(DIAMOND_BLOCK, pos(Math.randomRange(-10, 10), Math.randomRange(-3, -2), Math.randomRange(-10, 10)))
mobs.teleportToPosition(
mobs.target(ALL_PLAYERS),
pos(0, 0, 0)
)
gameplay.title(mobs.target(ALL_PLAYERS), "READY?", "Find the hidden diamond!")
})Python
def on_on_chat():
blocks.place(DIAMOND_BLOCK,
pos(Math.random_range(-10, 10),
Math.random_range(-3, -2),
Math.random_range(-10, 10)))
mobs.teleport_to_position(mobs.target(ALL_PLAYERS), pos(0, 0, 0))
gameplay.title(mobs.target(ALL_PLAYERS),
"READY?",
"Find the hidden diamond!")
player.on_chat("hunt", on_on_chat)