12 Replies Latest reply on Oct 19, 2006 9:05 AM by kglad

# Help with angles

Hey guys im trying to make a game like tank wars. I am having trouble figuring out how to get the angle to change. I want to be able to press "q" to raise the cannon and "a" to lower the cannon. Any help would be amazing
Thanks
• ###### 1. Re: Help with angles
the cannons registration point should be at its breech. if you orient the cannon horizonally on its timeline with its muzzle to the right (or left) of the breech, then you can use q and a to decrease (or increase) the _rotation of the cannon in order to raise and lower the cannon.
• ###### 2. Re: Help with angles
well i have the rotation working, but it is only working with the mouse x and y. I tried a few things and couldnt get it to work right with the "a" and "q".
• ###### 3. Re: Help with angles
you need a Key listener:

• ###### 4. Help with angles
Fixed it.
• ###### 5. Re: Help with angles
ok.
• ###### 6. Re: Help with angles
i have everything working pretty good now. I am just having trouble getting the bullets to arch.
• ###### 7. Re: Help with angles
for any given muzzle velocity the _x parameter of your bullet will be given by that velocity times the cosine of the cannon's angle and can be assumed to be constant while the bullet is in flight.

the _y paremeter is given by that velocity times the sine of the cannon's angle minus some constant times t*t where is the time the bullet is in flight.
• ###### 8. Re: Help with angles
im having trouble finding out the part where i need to get the time for the bullet. I setup a varrible called vol1 and that is for the volecity so the user can change it. Thaks for all the help so far.
• ###### 9. Help with angles
double post
• ###### 10. Re: Help with angles
try:

• ###### 11. Re: Help with angles
Thank you so much. I was trying to figure that out for hours.
• ###### 12. Re: Help with angles
you're welcome.