Material Box

Material Box

WEBデザイン & フリー素材

Godot - awaitで遅延処理を実装する

Godot

GDScriptにてawaitとcreate_timer()で遅延処理を実装するコード例です。


awaitとcreate_timer()を利用して遅延処理を実装する事が可能です。

このコードには以下の特徴があります。
create_timer()の引数に秒で遅延時間を指定
・以降にある処理をすべて遅延する

await get_tree().create_timer(3.0).timeout
print("await")

反復処理内で利用する場合、遅延時間を増やしていく事で期待した結果を得られる可能性があります。

for i in enemies:
	await get_tree().create_timer(i * 3).timeout
	print(i)

Godot

TitleGodot - awaitで遅延処理を実装する

CategoryGodot

Created

Update

AuthorYousuke.U