How to make a 2D character point left or right and make it shoot a projectile from either direction?

Godot Version 4.2.1

Hello, I’m developing a 2D platformer for a game jam and I want my character to shoot depending on the direction they’re facing, but I don’t quite get how to write it in code so the software is able to sense direction. My first idea was to make a custom signal from the player that detects every time left or right and return a value of 1 or -1 to make use of it in the projectile script to adjust the rotation value before it instantiates but I couldn’t quite figure out how to use signals that way, and nothing I found online worked.

Another method I found was to use dir = velocity.x / abs(velocity.x) to get the 1 or -1 for the x axis value and use that to change the projectile’s direction after it instantiates but I didn’t understand how to actually apply that value to the projectile’s properties. Here’s that post if you wanna see it for yourself: how to make enemy shoot projectile at right and left direction

So now I’m stuck. Is there another way to do this? Or can you guys help me with any of the methods I offered?

If the velocity.x is positive the player looks right, and the opposite. I Like to use an enum for this.

In the the ready function when you spawn the bullet, you check if the current_direction (enum) if LEFT or RIGHT.

In the update from the bullet you check if the bullet was fired left or right and with this state you add the velocity depending on the current_direction state