Need to fix downright

This commit is contained in:
ShabOl 2023-11-28 23:04:39 +04:00
parent 618f1926d6
commit 3c3fe9a53f
3 changed files with 15 additions and 2 deletions

View File

@ -14,6 +14,8 @@ public class BomberEntityBase
this.Speed = Speed;
this.Weight = Weight;
this.BodyColor = BodyColor;
this.Step = (double)Speed * 100 / Weight * 5 / 2;
}
public int GetSpeed() { return Speed; }

View File

@ -9,7 +9,7 @@ public class BomberRenderer extends BomberRendererBase
{
super(Speed, Weight, BodyColor, Width, Height, 200, 200);
if (EntityBomber == null)
if (EntityBomber != null)
EntityBomber = new BomberEntity(Speed, Weight, BodyColor, AdditionalColor, FuelTanks, Bombs);
}

View File

@ -4,6 +4,7 @@ import AirBomber.*;
import AirBomber.Entities.*;
import AirBomber.MovementStrategy.*;
import java.awt.*;
import java.util.Random;
public class BomberRendererBase
{
@ -35,6 +36,11 @@ public class BomberRendererBase
_pictureHeight = Height;
EntityBomber = new BomberEntityBase(Speed, Weight, BodyColor);
EngineRenderer = new EngineRenderer();
Random Random = new Random();
EngineRenderer.SetAmount(Random.nextInt(1, 7));
}
public BomberRendererBase(int Speed, double Weight, Color BodyColor, int Width, int Height, int EntityWidth, int EntityHeight)
@ -49,6 +55,11 @@ public class BomberRendererBase
_bomberHeight = EntityHeight;
EntityBomber = new BomberEntityBase(Speed, Weight, BodyColor);
EngineRenderer = new EngineRenderer();
Random Random = new Random();
EngineRenderer.SetAmount(Random.nextInt(1, 7));
}
public BomberEntityBase GetEntityBomber() { return EntityBomber; }
@ -98,7 +109,7 @@ public class BomberRendererBase
public void MoveEntity(DirectionType Direction)
{
if (EntityBomber == null)
if (EntityBomber == null || !CanMove(Direction))
return;
switch (Direction)