Need Help Coding Gun System For 2D Game

I am planning on adding a gun for a player, but I don’t know how to code such a system. Does anyone know how to code a gun in playcanvas?

Are you creating your game using a 1st person or 3rd person perspective?

Well it isn’t 3D. It’s for a 2D game. It should be able to shoot on a key press and maybe mouse cursor can be used to change angle of the gun.

This would be an excellent tutorial to reference for that particular game mechanic:

PlayCanvas 2D Space Shooter Tutorial