exit teleport animation :)

This commit is contained in:
Haze Weathers 2023-10-07 21:43:05 -04:00
parent a03a1d8f6d
commit c25382dd83
6 changed files with 100 additions and 9 deletions

View file

@ -2,6 +2,7 @@ extends KinematicBody2D
# SIGNALS #
signal died()
signal teleport_finished()
# CONSTANTS #
const ArrowProjectile = preload("res://objects/player/arrow_projectile.tscn")
@ -317,6 +318,20 @@ func _on_Inactive_state_entered() -> void:
func _on_Inactive_state_exited() -> void:
body_shape.disabled = false
func _on_Teleporting_state_entered() -> void:
velocity = Vector2.ZERO
animation_player.play("idle")
var tween = create_tween()
for i in 8:
tween.tween_property(sprite, "position:x", 1.0, 0.0333333)
tween.tween_property(sprite, "position:x", -1.0, 0.0333333)
tween.tween_property(sprite, "position:x", 0.0, 0.0666667)
yield(tween, "finished")
sprite.visible = false
$"%DissolveParticles".emitting = true
yield(get_tree().create_timer(1.0, false), "timeout")
emit_signal("teleport_finished")
# STATE PROCESSING #
## when on ground