Weyert, Here's my approach. Set the registration of the sprites (buildings) to the bottom center and then use the following to determine the rotation:
var rotation = (180 - angle); Hope this helps. Tony On Mon, Nov 9, 2009 at 10:41 AM, W.R. de Boer <w...@innerfuse.biz> wrote: > > Hello, > > I am currently working on a little flash project where I would like to place > the sprites or elements on the line or circumference of a circle. Now I know > how I can get x,y-position of each sprite using the cosinus and sinus > functions together with the radius and angle. Only the problem I am currently > experiencing is the putting the sprites nicely on the line of the circle. > It's some rotation related thing but I don't get it. > > The basic idea is to have an earth and then all kind of items such as > buildings to be positioned on the line/circumference of the circle and then > follow the form of the circle. I only don't get it. > > I know I can get the x,y position for these (building) sprites the following > way: > > var radius: Number = 50; > var angle: Number = 60; > > var x: Number = Math.sin(Math.PI/180 * angle) * radius; > var y: Number = Math.cos(Math.PI/180 * angle) * radius; > > Now I only have the problem to nicely rotate the sprite in such manner is > basically following the form of the circle. I have made a drawing of how > the sprites and/or buildings (every rectangle is a sprite) should be placed > on the circle [1] but I don't know how i get that nice rotation calculated. > > Anyone having any idea how to do this? Too bad, they didn't discuss this > during math class :( > > [1] http://i35.tinypic.com/2a7daop.jpg > > Weyert > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders