I am not sure how to approach this. I am trying to make a 2D top down game, but I am not sure how to get the bullet to shoot at the direction where the player is facing at. I looked up some stuff on google, but I am still confused. Can someone give me some hints on how to approach this? Thank you.
This is a post I found on reddit that seems really helpful, but one part is confusing for me:
"So a simple overview of what you need to do would be:
create a bullet scene, which consists of a kinematic body (named "bullet"), with a sprite and a collision body2d as children. add it to the group "bullets"
add a bullet script to your bullet node. It will be responsible for moving your bullet along a specified direction, which is a Vector2. In process you'll do something like move(direction * speed* delta). You can also add a killbullet function that will remove your bullet if it hits a wall, goes off screen, etc...
in your player script, when you hit the fire button, instantiate a new bullet and set its direction to the same direction as the player.
have your enemies look for collision with a body in group "bullets", and take damage accordingly."
The part I am not sure what to do is how do I instantiate a bullet and tell it the direction the player is facing? Thank you for helping me out.