ПИбд-21 Ярускин Салих 8 лаб простая #8

Closed
Salikh wants to merge 6 commits from laba8 into laba7
Showing only changes of commit 33e0697a25 - Show all commits

View File

@ -52,13 +52,13 @@ namespace AirBomber.DrawningObjects
}
public void SetPosition(int x, int y)
{
if (_startPosX + _PlaneWidth > _pictureWidth)
if (x < 0 || x + _PlaneWidth > _pictureWidth)
{
_startPosX = _pictureWidth - _PlaneWidth;
x = _pictureWidth - _PlaneWidth;
}
if (_startPosY + _PlaneHeight > 740)
if (y < 0 || y + _PlaneWidth > _pictureHeight)
{
_startPosY = 740 - _PlaneHeight;
y = _pictureHeight - _PlaneWidth;
}
_startPosX = x;
_startPosY = y;