Making a shooting game

Hi,
I’m making a shooting game where you play as a man with a gun and the view is an eagle-eye view (you can only see the man’s head). The gun has 8 angles (up, down, left, right and diagonals) and the ‘bullet’ which I want the gun to shoot is a straight line. I made it so the bullet is the same angle as the gun, but what I can’t do is make it move in the right way i want it to move (ex. Move up when the gun is pointing up). Is there a code for this? Thanks!