ISEbd-12_Khaliullov_LabWork01_Simple #1
BIN
Stormtrooper.rar
Normal file
BIN
Stormtrooper.rar
Normal file
Binary file not shown.
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user