New position X and Y depending on direction and distance?

1

I'm doing a mini shooting game in XNA but I can not figure out how to calculate the following:

Knowingthepositionofthecenteroftheimage,thedirectioninwhichitispointingandthedistancebetweenthecenterandthe"nozzle" of the weapon, how to know the X and Y position of the weapon's spout?     

asked by anonymous 21.09.2016 / 12:27

1 answer

3

I found the answer:

newX = X + (raio) * cos⁡(ang);
newY = Y + (raio) * sin(ang);

Source: Click here

    
21.09.2016 / 12:57