This commit is contained in:
Ivan Rotov 2025-02-17 13:07:02 +04:00
parent 90dcb90e2c
commit 449a5c1655

View File

@ -20,9 +20,9 @@ public class DrawingStormTrooper
private int? _startPosY; private int? _startPosY;
private readonly int _drawingTrooperWidth = 150; private readonly int _drawingTrooperWidth = 140;
private readonly int _drawingTrooperHeight = 140; private readonly int _drawingTrooperHeight = 120;
public void Init(bool wing, int speed, double weight, Color bodyColor, Color additionalColor, bool bodyRockets, bool bombs) public void Init(bool wing, int speed, double weight, Color bodyColor, Color additionalColor, bool bodyRockets, bool bombs)
{ {
@ -36,6 +36,9 @@ public class DrawingStormTrooper
public bool SetPictureSize(int width, int height) public bool SetPictureSize(int width, int height)
{ {
if (_drawingTrooperHeight > height || _drawingTrooperWidth > width) { return false; }
_pictureWidth = width; _pictureWidth = width;
_pictureHeight = height; _pictureHeight = height;
@ -47,6 +50,10 @@ public class DrawingStormTrooper
{ {
return; return;
} }
if (x < 0 || y < 0 || x + _drawingTrooperWidth > _pictureWidth || y + _drawingTrooperHeight > _pictureHeight)
{
return;
}
_startPosX = x; _startPosX = x;
_startPosY = y; _startPosY = y;
} }