# How to get point from which bullets needs to be shooted if ship rotates?

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

## Recommended Posts

I tried using something like its on this picture : http://i50.tinypic.com/xknfux.png But problem is that i can't get the center. I have angle, origin of rotation ( constant that doesnt change when sprite moves and rotates) and x and y of sprite that is top left of sprite. X and y don't change when sprite rotates. But from what i see x+width/2 , y+height/2 should give the center but i dont get good results.. When i send x and y only everything is moved a little down and to right... So did i done something wrong? ( look at pic ) So again : if i have coordinates relative to the sprite from which bullets are shooted, how those coordinates are changed when sprite moves and rotates?? Thx in advance..

##### Share on other sites
I believe you have to negate the sin of the angle to get Y, so that when using angle 90 for example X,Y for 1 point away from the center (assumed 0,0) will be (1,0) for 0 degrees (facing east), (0,-1) for 90 degrees (north), (-1,0) for 180 degrees (west), (0,1) for 270 degrees (south.) I'm assuming you are using trig angle for you ship also so that when the ship is facing west it will be at 0 degrees and north would be 90 degrees. Hope that helps.

Also until you get it down pat I recommend just firing at the same angle the ship is facing. Adding the angles is nothing but if you hold off until you get it right you can make sure bullets are coming out correctly.

• 47
• 12
• 10
• 10
• 9
• ### Forum Statistics

• Total Topics
631373
• Total Posts
2999643
×