Let's see how much I remember from physics...

Well, an object's horizontal movement is independent of its vertical movement, so if you throw a ball, it will keep moving horizontally at a constant speed (ignoring friction/air resistance, which you might have to incorporate into your physics logic) even though gravity causes it to accelerate downward at 9.8 m/s/s.

I would recommend doing the calculations before launching the cannon, because it's all based on the angle. Find out how many units horizontally and how many units vertically the cannonball will move at a time based on the angle. Unless you decide to implement friction/air resistance (which I'm a little rusty on, ask someone else about that), the variable for horizontal speed will not change throughout the flight, but the variable for vertical speed must be decreased by 9.8 m/s/s (or some reasonable equivalent ) with each loop of your logic.