#### Archived

This topic is now archived and is closed to further replies.

# Fire bullets from an object made out of lines

This topic is 6940 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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);

##### Share on other sites
Are you using floating point numbers for x and y?

=> Arfa <=

##### Share on other sites
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

##### Share on other sites
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.

##### Share on other sites
Thanks to everyone who took the time to reply my post. I think I should be able to implement the suggestion given by Zipster, thanks guys.

• 15
• 13
• 35
• 39
×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!