#Correct way of handling velocity (assign value vs increment/decrement)

1 messages · Page 1 of 1 (latest)

kind vector
#

a simple trick is to store knockback_velocity in a separate variable. then before you call move_and_slide() you can just add this knockback velocity to your existing velocity

#

and if you run something like knockback_velocity= knockback_velocity.move_toward(Vector2.ZERO, knockback_decay * delta) in addition you can make sure the knockback effect fades out