I have a bullet sprite, and a character sprite with a gun as a part of it. When I click, I want the bullet to appear on the end of the gun. This isn't possible for me since the character sprite, changes rotation depending on where the mouse is on the screen.
This would only work if my sprite was rotated at a 0 degree angle.
float x = player.character.getPosition().x + 10;
float y = player.character.getPosition().y - 80;
If I changed the rotation, the
x and
y would not change as they depend on the character's position not rotation.
I have messed a bit with the trigonometry functions(cos, sin) but had no luck.
How would I make the bullet's position depend on the rotation?
I attached both images in case someone needs to look at the dimensions.
Note: Both sprites are scaled down to fit the screen, so the dimensions here aren't the one I am using
CharacterRifle: Scaled down by 0.5
Bullet: Scaled down by 0.03