Первая лабораторная работа. Изменение ограничений на перемещение

This commit is contained in:
Алина Батылкина 2022-09-26 21:55:34 +04:00
parent a3414973c1
commit fb6cec9d63

View File

@ -19,11 +19,13 @@
}
public void SetPosition(int x, int y, int width, int height)
{
// TODO checks
_startPosX = x;
_startPosY = y;
_pictureWidth = width;
_pictureHeight = height;
if (x + _WarmlyShipWidth <= width && y + _WarmlyShipHeight <= height && x >= 0 && y >= 0)
{
_startPosX = x;
_startPosY = y;
_pictureWidth = width;
_pictureHeight = height;
}
}
public void MoveTransport(Direction direction)
{
@ -35,7 +37,7 @@
{
// вправо
case Direction.Right:
if (_startPosX + _WarmlyShipWidth + WarmlyShip.Step < _pictureWidth)
if (_startPosX + _WarmlyShipWidth + WarmlyShip.Step + 60 < _pictureWidth)
{
_startPosX += WarmlyShip.Step;
}
@ -56,7 +58,7 @@
break;
//вниз
case Direction.Down:
if (_startPosY + _WarmlyShipHeight + WarmlyShip.Step < _pictureHeight)
if (_startPosY + _WarmlyShipHeight + WarmlyShip.Step + 40 < _pictureHeight)
{
_startPosY += WarmlyShip.Step;
}