I have a character that i want to bounce away in the opposite direction its colliding with the enemy in. However when the character collides it only bounes upwards ignoring the x velocity I'm trying to add.
func hit(var enemy_pos):
velocity.y = jumpHeight
if position.x < enemy_pos:
velocity.x = -speed * 2
velocity.x = speed * 2
I'm using an Area2D for the colliding object, and the character is a kinematicbody2D
it accurately identifies position of the object relative to the character