Right! (Touché!)
Your turn Gurok
Your turn Gurok

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuoteI have the best shirts.
//2d array containing x,y coordinates for all the waypoints
int WayPoints[20];
//2d array containing the coordinates of waypoints to use
int CurrentWayPoints[20];
//simple math formula here
int GetDistance(x1, y1, x2, y2);
//get waypoints between pc position and destination/store them in CurrentWayPoints
void GetWayPoints();
//sort them with getdistance() or any algorithm
void SortWayPoints();
//on walkto action
if(GetDistance(player.X, player.Y, mouse.x, mouse.y) >= cutoff_point)
{
int target_x = mouse.x;
int target_y = mouse.y;
GetWayPoints();
SortWayPoints();
int i = 0;
while(i<20)
{
if(CurrentWayPoints[i] != -1 && CurrentWayPoints[i+1] != -1) //-1 means its not active
player.Walk(CurrentWayPoints[i], CurrentWayPoints[i+1], eBlock, eWalkableAreas);
i+=2;
}
player.Walk(target_x, target_y, eBlock, eWalkableAreas);
}
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.038 seconds with 15 queries.