ISEbd-12_Khaliullov_LabWork01_Simple #1

Closed
rakhaliullov wants to merge 2 commits from LabWork1 into main
2 changed files with 11 additions and 4 deletions
Showing only changes of commit a1ae8210cf - Show all commits

BIN
Stormtrooper.rar Normal file

Binary file not shown.

View File

@ -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;
}
}