Shooting with angle

good morning to all i am in serious trouble with a code i want a bullet to follow the angle of a cannon but no in straight direction but following the angle please help me