lab1
This commit is contained in:
parent
0b05f36492
commit
a1ae8210cf
BIN
Stormtrooper.rar
Normal file
BIN
Stormtrooper.rar
Normal file
Binary file not shown.
@ -12,7 +12,7 @@ namespace Stormtrooper;
|
|||||||
public class DrawningStormtrooper
|
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
|
public void Init(int speed, double weight, Color bodyColor, Color
|
||||||
additionalColor, bool rocket, bool bomb, bool wing)
|
additionalColor, bool rocket, bool bomb, bool wing)
|
||||||
{
|
{
|
||||||
EntityStormtrooper = new EntityStormtrooper();
|
EntityStormtrooper = new EntityStormtrooper(); // инициализация
|
||||||
EntityStormtrooper.Init(speed, weight, bodyColor, additionalColor,rocket, bomb, wing);
|
EntityStormtrooper.Init(speed, weight, bodyColor, additionalColor,rocket, bomb, wing);
|
||||||
_pictureWidth = null;
|
_pictureWidth = null;
|
||||||
_pictureHeight = null;
|
_pictureHeight = null;
|
||||||
@ -89,14 +89,21 @@ public class DrawningStormtrooper
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x < 0 || x + _drawningStormtrooperWidth > _pictureWidth || y < 0 || y + _drawningStormtrooperHeight > _pictureHeight)
|
if (x < 0 || x + _drawningStormtrooperWidth > _pictureWidth)
|
||||||
{
|
{
|
||||||
_startPosX = _pictureWidth - _drawningStormtrooperWidth;
|
_startPosX = _pictureWidth - _drawningStormtrooperWidth;
|
||||||
_startPosY = _pictureHeight - _drawningStormtrooperHeight;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_startPosX = x;
|
_startPosX = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y < 0 || y + _drawningStormtrooperHeight > _pictureHeight)
|
||||||
|
{
|
||||||
|
_startPosY = _pictureHeight - _drawningStormtrooperHeight;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
_startPosY = y;
|
_startPosY = y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user