Godot Version
4.2.1
Question
I’m using states in my game for the player, one of the states I added is diving/dashing to evade. I made so that when I press Shift it emits a signal that then moves my player in it’s facing direction, but the script I’m using just moves the player instantly. How can I make it so that the player moves smoothly, throughout the time the diving animation takes to complete?
This is what I’m using to move the character when diving.
func _evade(evade_state :JumpState): ##This is the emitted signal
player.velocity = direction * evade_state.jump_height
Sorry, I already solved this by using tweens:
func _evade(evade_state :JumpState):
evade_tween = get_tree().create_tween()
evade_tween.tween_property(player, "velocity", direction * evade_state.jump_height, evade_state.apex_duration )