fix error
This commit is contained in:
parent
908ca82192
commit
5fb60274de
@ -32,10 +32,12 @@ namespace AirFighter
|
||||
|
||||
private (int mapI, int mapJ) checkBarrier((float Left, float Right, float Top, float Bottom) rect)
|
||||
{
|
||||
for (int i = (int)(rect.Top / _size_y); i <= (int)(rect.Bottom / _size_y); ++i)
|
||||
for (int i = (int)(rect.Top / _size_y); i <= (int)(rect.Bottom / _size_y) && i < _map.GetLength(0); ++i)
|
||||
{
|
||||
for (int j = (int)(rect.Left / _size_x); j <= (int)(rect.Right / _size_x); ++j)
|
||||
for (int j = (int)(rect.Left / _size_x); j <= (int)(rect.Right / _size_x) && j < _map.GetLength(1); ++j)
|
||||
{
|
||||
if (j < 0) j = 0;
|
||||
if (i < 0) i = 0;
|
||||
if (_map[i, j] == _barrier) return (i, j);
|
||||
}
|
||||
}
|
||||
@ -56,6 +58,8 @@ namespace AirFighter
|
||||
if (direction == Direction.Up) position.Top -= _drawningObject.Step;
|
||||
if (direction == Direction.Down) position.Top += _drawningObject.Step;
|
||||
|
||||
|
||||
|
||||
position.Right = position.Left + drawningWidth;
|
||||
position.Bottom = position.Top + drawningHeight;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user