So my goal is to move CharacterBody2d in a direction for set amount of time and set amount of speed. This should work if the player in not pressing direction buttons.
I am kinda at a loss. I was expecting this to move character indefinitely until the bool is changed. But it ran only once. I am new to programming and godot in general. Sorry for a stupid question.
func rolling(delta):
if is_rolling==true:
velocity.x = direction_facing9000delta
With all that, you now need to add the value_to_add_per_second to your current position in a process function:
func _physics_process(p_delta):
if time_needed_to_add > 0:
time_needed_to_add -= p_delta
# Set the value to avoid us some trouble with floating points
if time_needed_to_add <= 0:
position = goal_position
else:
position += value_to_add_per_second * p_delta
You might have notice that the value_to_add_per_second is multiplied by delta,
it is done so to accomodate your “per_second_calcul” with how often the process is called.
Interesting but not what am looking for (but thank you I am 100% sure I will use it!) . I am starting to think I can achieve what I want with animation node.