Help with a gun

hello i need help geting a shooting system in my game
i got the basics with gun and player movement im just not sure hoow to get the bullet to go in the dirction of the gun an anyone help?
i cant upload rn as i am a new user so ill just put the code here

if (isKeyDown(‘z’)){gun.rotation += 20}
if (isKeyDown(‘x’)){gun.rotation -= 20}

if (isKeyJustPressed(“c”)) {}
if ( {this.x-=20}

Hey, sorry for the really late reply. But there is a very old topic where I asked a similar question.

they reading through this, it might help.