View Single Post
  #2  
Old 01-14-2011, 05:29 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
To draw a circle you'll need to use sine and cosine

PHP Code:
temp.circle NULL;

for ( 
temp.0temp.< ( pi); temp.+= ( pi 32);)
{

  
temp.circle.addplayer.costemp.a));
  
temp.circle.addplayer.sintemp.a));

}

showPoly1temp.circle); 
Basically adjust the 32 is the number of sides in the circle. It's not a true circle, but visually it's pretty close, increase it for a smoother edges, but costs for cpu time.

To get a a circle on a quadrant plane you use
X = ORGINX + RADIUS * cos( ANGLE);
Y = ORGINY - RADIUS * sin( ANGLE);

Orgins are the center x/y points of the circle
Radius is the number of tiles for the center point
Angle is the well the angle from the center that we are drawing

As for moving along angles, it involves sine and cosine again.
PHP Code:
temp.angle getanglevecxplayer.dir), vecyplayer.dir));

player.+= costemp.angle) * 0.5;
player.+= -sintemp.angle) * 0.5
Basically getangle() works by getting values and computing its angle
So it gets values in vectors. Grall operates as so, East is 0/360 degrees and north is 90 degress and so forth.
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!

Last edited by MrOmega; 01-14-2011 at 05:39 AM..
Reply With Quote