Compare commits

...

3 Commits

Author SHA1 Message Date
3f2e056315 обновление 2023-11-14 19:15:16 +04:00
3c3737fc84 J,yjdf 2023-11-05 17:23:51 +04:00
b8df03df51 Обновление 2023-10-17 22:59:22 +04:00
2 changed files with 17 additions and 41 deletions

View File

@ -21,7 +21,7 @@ namespace AirBomber
private int _PlaneWidth = 160;
private int _PlaneHeight = 210;
private int _PlaneHeight = 185;
public bool Init(int speed, int weight, Color bodycolor, Color dopcolor, bool bodykit, bool toplivo, bool rocket, int width, int height)
{
@ -41,13 +41,11 @@ namespace AirBomber
{
//TODO: Изменения x, y
if (x <= _pictureWeigth - _PlaneWidth && y <= _pictureHeight - _PlaneHeight)
if (x <= _pictureWeigth - _PlaneWidth && x >= 0 && y <= _pictureHeight - _PlaneHeight && y >= 0)
{
_startPosX = x;
_startPosY = y;
}
/*_startPosX = x;
_startPosY = y;*/
}
public void MoveTransport(Diraction diraction)
@ -57,75 +55,54 @@ namespace AirBomber
return;
}
int step = (int)EntityAirBomber.Step;
switch (diraction)
{
case Diraction.Left:
if (EntityAirBomber.BodyKit)
if (_startPosX - step >= 0)
{
if (_startPosX - EntityAirBomber.Step > 0)
{
_startPosX -= (int)EntityAirBomber.Step;
}
_startPosX -= step;
}
else
{
if (_startPosX - EntityAirBomber.Step > 0)
{
_startPosX -= (int)EntityAirBomber.Step_No_Obves;
}
_startPosX = 0;
}
break;
case Diraction.Right:
if (EntityAirBomber.BodyKit)
if (_startPosX + step + _PlaneWidth <= _pictureWeigth)
{
if (_startPosX + EntityAirBomber.Step + _PlaneWidth < _pictureWeigth)
{
_startPosX += (int)EntityAirBomber.Step;
}
_startPosX += step;
}
else
{
if (_startPosX + EntityAirBomber.Step + _PlaneWidth < _pictureWeigth)
{
_startPosX += (int)EntityAirBomber.Step_No_Obves;
}
_startPosX = _pictureWeigth - _PlaneWidth;
}
break;
case Diraction.Up:
if (EntityAirBomber.BodyKit)
if (_startPosY - step >= 0)
{
if (_startPosY - EntityAirBomber.Step > 0)
{
_startPosY -= (int)EntityAirBomber.Step;
}
_startPosY -= step;
}
else
{
if (_startPosY - EntityAirBomber.Step > 0)
{
_startPosY -= (int)EntityAirBomber.Step_No_Obves;
}
_startPosY = 0;
}
break;
case Diraction.Down:
if (EntityAirBomber.BodyKit)
if (_startPosY + step + _PlaneHeight <= _pictureHeight)
{
if (_startPosY + EntityAirBomber.Step + _PlaneHeight < _pictureHeight)
{
_startPosY += (int)EntityAirBomber.Step;
}
_startPosY += step;
}
else
{
if (_startPosY + EntityAirBomber.Step + _PlaneHeight < _pictureHeight)
{
_startPosY += (int)EntityAirBomber.Step_No_Obves;
}
_startPosY = _pictureHeight - _PlaneHeight;
}
break;
}
}
public void DrawCar(Graphics g)
{
if (EntityAirBomber == null)

View File

@ -23,7 +23,6 @@ namespace AirBomber
public bool Rocket { get; private set; } //ракеты
public double Step => (double)Speed * 100 / Weight;
public double Step_No_Obves => (double)Speed * 200 / Weight;
public void Init(int speed, int weight, Color bodycolor, Color dopcolor, bool bodykit, bool toplivo, bool ropcket)
{