LoginLogin

Cannon Bullet Rotation

Root / Programming Questions / [.]

randoCreated:
Yes, I'm working on Ruebled right now. But I need help with a so-far unannounced game. I have a circle being the tank and a cannon sprite going around it with sprot. I am wondering how to make bullets and other fun stuff shoot out of the cannon, how to calculate where the bullet should shoot out. I have a variable to where the cannon is pointed, so that if you press one button it increases the angle, and another to decrease it. I want a fast way to make the bullet shoot out of the cannon, in all 360 angles. Please help! If you are mad at me for not working on Ruebled, I am. I just want this bit of help for when it's not my turn.

The x velocity will be COS(angle)*speed, and y velocity is SIN(angle)*speed. If you're using degrees, you'll have to convert the angle to radians using RAD().

The x velocity will be COS(angle)*speed, and y velocity is SIN(angle)*speed. If you're using degrees, you'll have to convert the angle to radians using RAD().
What do I do after I convert it to radians? How would I use the radians? EDIT: nvm I just realized cos and sin use radians.

Jes! It works! Now I just have to add a few things.