Wednesday, May 5, 2010

Path Follow

Vector2 location = new Vector2(400, 300);

int pathIndex = 1;


...


if (pathIndex == 1 && location.Y >= 100)
{
location.Y--;

if (location.Y == 100)
pathIndex = 2;
}

if (pathIndex == 2 && location.X <= 700)
{
location.X++;

if (location.X == 700)
pathIndex = 3;
}

No comments: