Skip to content

Instantly share code, notes, and snippets.

@PJZ9n
Last active September 1, 2020 07:23
Show Gist options
  • Save PJZ9n/e1a84eb3c5f04106792afb0e1baf4a88 to your computer and use it in GitHub Desktop.
Save PJZ9n/e1a84eb3c5f04106792afb0e1baf4a88 to your computer and use it in GitHub Desktop.
浮き文字
<?php
declare(strict_types=1);
use pocketmine\level\Level;
use pocketmine\level\particle\FloatingTextParticle;
use pocketmine\math\Vector3;
use pocketmine\plugin\Plugin;
use pocketmine\scheduler\ClosureTask;
/** @var Vector3 $pos */
$particle = new FloatingTextParticle($pos, "テキスト\n改行あああ", "タイトル(任意)");//パーティクル作成
/** @var Level $level */
$level->addParticle($particle);//ワールドに出す
//タスク
$task = new ClosureTask(function (int $currentTick) use ($particle, $level): void {
$particle->setInvisible(true);//パーティクルを見えなくする(これ以外に消す方法あるかも)
$level->addParticle($particle);//見えなくしたのを反映させる
});
/** @var Plugin $plugin */
$plugin->getScheduler()->scheduleDelayedTask($task, 20 * 5);//5秒後に実行
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment