Godot - Tweenで移動アニメーションを実装する
GDScriptのTweenを利用して移動アニメーションを実装するコード例です。
Tweenを利用して移動アニメーションを実装します。create_tween()
で新規Tweenを作成、tween_property()
にて「position」の変更アニメーションを作成します。
移動アニメーションさせたい対象のノードにTweenを作成します。
# tween_property( 対象のノード, "position", Vector2(X, Y), 処理時間)
# 移動アニメーション
var tween = create_tween()
tween.tween_property(self, "position", Vector2(100, 100), 1.0)
tween.play()
![Godot](/images/godot/image.png)