How to make an object directions when spawning

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jbliss243

I have a bullet in my game that flies out of the player however, the bullet only flies out the right side and even if my character is moving to the left it is moving to the right. How do I fix this? (Here’s the bullet spawning code):

var bullet_instance = bullet.instance()

bullet_instance.position = get_global_position()

bullet_instance.rotation_degrees = rotation_degrees

bullet_instance.apply_impulse(Vector2(),Vector2(bullet_speed,0).rotated(rotation))

get_tree().get_root().call_deferred(“add_child”,bullet_instance)