|
Britbot
|
given your location and your heading this function calculates your new position after going with the vector. consider the bounderies of the game
Definition at line 228 of file HeadingVector.cs. {
//calculate new col
int col = loc.Col + (int) hv.X;
int row = loc.Row + (int) hv.Y;
//check if out of boundries
//first check negative valuse
col = Math.Max(col, 0);
row = Math.Max(row, 0);
//check to big boundries
col = Math.Min(col, Bot.Game.GetCols() - 1);
row = Math.Min(row, Bot.Game.GetRows() - 1);
//return new location
return new Location(row, col);
}
|
1.7.6.1