diff --git a/Stormtrooper.rar b/Stormtrooper.rar new file mode 100644 index 0000000..3a4d9e4 Binary files /dev/null and b/Stormtrooper.rar differ diff --git a/Stormtrooper/Stormtrooper/DrawningStormtrooper.cs b/Stormtrooper/Stormtrooper/DrawningStormtrooper.cs index 28471bc..937731a 100644 --- a/Stormtrooper/Stormtrooper/DrawningStormtrooper.cs +++ b/Stormtrooper/Stormtrooper/DrawningStormtrooper.cs @@ -12,7 +12,7 @@ namespace Stormtrooper; public class DrawningStormtrooper { // Класс-сущность - public EntityStormtrooper? EntityStormtrooper { get; private set; } + public EntityStormtrooper? EntityStormtrooper { get; private set; } // объявление // Ширина окна @@ -50,7 +50,7 @@ public class DrawningStormtrooper public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool rocket, bool bomb, bool wing) { - EntityStormtrooper = new EntityStormtrooper(); + EntityStormtrooper = new EntityStormtrooper(); // инициализация EntityStormtrooper.Init(speed, weight, bodyColor, additionalColor,rocket, bomb, wing); _pictureWidth = null; _pictureHeight = null; @@ -89,14 +89,21 @@ public class DrawningStormtrooper return; } - if (x < 0 || x + _drawningStormtrooperWidth > _pictureWidth || y < 0 || y + _drawningStormtrooperHeight > _pictureHeight) + if (x < 0 || x + _drawningStormtrooperWidth > _pictureWidth) { _startPosX = _pictureWidth - _drawningStormtrooperWidth; - _startPosY = _pictureHeight - _drawningStormtrooperHeight; } else { _startPosX = x; + } + + if (y < 0 || y + _drawningStormtrooperHeight > _pictureHeight) + { + _startPosY = _pictureHeight - _drawningStormtrooperHeight; + } + else + { _startPosY = y; } }