I have 2 sprites and when i click on both of them a tiled object is created between them sort of a link whose width is equal to distance between them them problem i have is how to rotate the link in such a way that the link connects the 2 sprites. The link tiled object is rotate at the center point. How do i rotate it from the origin ?
You can’t edit tiled objects points… so you’ll have to place the tiled object so its center is between both objects and then rotate it, as you’ve put the center point in the right position the rotation will look fine, not tested but should be like:
Do = (SpriteB.PointX(Centre) + SpriteA.PointX(Centre)) / 2 - Tiled.Width() / 2 to the X position of Tiled
Do = (SpriteB.PointY(Centre) + SpriteA.PointY(Centre)) / 2 - Tiled.Height() / 2 to the Y position of Tiled
Do = ToDeg(atan2(SpriteB.PointY(Centre) - SpriteA.PointY(Centre), SpriteB.PointX(Centre) - SpriteA.PointX(Centre))) to the angle of Tiled
Hi, Thanks a lot it works.