Rotate the sprite the same as the angle your using. So if it is at the top
of the circle use 90 degrees, if it is half way between the equator and the
north pole then 45 degrees etc...

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of W.R. de Boer
Sent: Monday, November 09, 2009 10:41 AM
To: [email protected]
Subject: [Flashcoders] Placing sprites on the circumference of a circle

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
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


__________ Information from ESET NOD32 Antivirus, version of virus signature
database 4588 (20091109) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


 

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 4588 (20091109) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 

_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to