PDA

View Full Version : [AS2] shooting bullets at angles...


.<max>.
04-16-2009, 09:43 AM
I'm just learning AS, and I have met a small caveat- I can control the pitch of the object in my game, but the bullets still travel along _x.

So my question is how do I make the bullets perpendicular to my object. If you want demo code or anything, just ask- I'm not on my computer right now.

Thanks in advance everyone

szataniol
04-16-2009, 11:11 AM
_x += Math.sin(_rotation / 180 * Math.PI * velocity;
_y -= Math.cos(_rotation / 180 * Math.PI * velocity;

velocity is your total speed.