PIbd-12_Rotov_I.P._Simple #1

Merged
irotov merged 3 commits from lab1 into main 2025-02-20 11:44:17 +04:00
Showing only changes of commit 449a5c1655 - Show all commits

View File

@ -20,9 +20,9 @@ public class DrawingStormTrooper
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)
{
@ -36,6 +36,9 @@ public class DrawingStormTrooper
public bool SetPictureSize(int width, int height)
{
if (_drawingTrooperHeight > height || _drawingTrooperWidth > width) { return false; }
_pictureWidth = width;
_pictureHeight = height;
@ -47,6 +50,10 @@ public class DrawingStormTrooper
{
return;
}
if (x < 0 || y < 0 || x + _drawingTrooperWidth > _pictureWidth || y + _drawingTrooperHeight > _pictureHeight)
{
return;
}
_startPosX = x;
_startPosY = y;
}