how can I get an image to set its position according to the end of another image?
this is what I have so far
rocketPosition = players.Position;
rocketPosition.X += players.Position.X +40;
rocketPosition.Y -= players.Position.Y -370 ;
rocketAngle = players.Angle;
Vector2 up = new Vector2(0, -1);
Matrix rotMatrix = Matrix.CreateRotationZ(rocketAngle);
rocketDirection = Vector2.Transform(up, rotMatrix);
rocketDirection *= players.Power / 50.0f;
the rocket goes in the right direction but its starting position is wrong if I move the cannon
the code that moves the cannon
if (keybState.IsKeyDown(Keys.Left))
{
if(players.Angle > MathHelper.PiOver4-.3)
players.Angle -= 0.01f;
}
if (keybState.IsKeyDown(Keys.Right))
{
if (players.Angle < MathHelper.PiOver2)
players.Angle += 0.01f;
}