Fire bullets from an object made out of lines
Hello everyone,
I''m trying to make a game where I have a spaceship that fires bullets in the direction that it''s pointing. I''ve tried using the following formulas listed below, from which I would find the slope in hopes of using it to direct the bullet to it''s target, but it doesn''t seem to work, instead of going in the intended direction, the bullets always go in a straight. Can anyone give me a hand, thank you.
x = cos(ang);
y = sin(ang);
** boolean010 **
Don''t forget also that cos() and sin() must have the angle parameter in radians! Just multiply by PI and divide by 180. Good luck.
ColdfireV
ColdfireV
[email=jperegrine@customcall.com]ColdfireV[/email]
i had the same problem with my stuff, and the way i solved it was simple, although it may not work since its specific. If you''re talking about a polygon ship, then simply get the slope between the center of the polygon and the vertex where the bullet is shooting out of, and use that for the bullet.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement