PIbd-22_Aleikin_A.M._AirBom.../DrawningWarplane.java

43 lines
1.3 KiB
Java

import java.awt.*;
public class DrawningWarplane extends DrawningBomber
{
public DrawningWarplane(int speed, float weight, Color bodyColor, Color dopColor, boolean engines, boolean weapons)
{
super(speed, weight, bodyColor, 120, 120);
AirBomber = new EntityWarplane(speed, weight, bodyColor, dopColor, engines, weapons);
}
@Override
public void DrawTransport(Graphics g)
{
if (!(AirBomber instanceof EntityWarplane warplane))
{
return;
}
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(Color.BLACK);
g2d.setColor(warplane.GetDopColor());
if (warplane.GetEngines())
{
g2d.fillOval((int)_startPosX + 50, (int)_startPosY + 40, 30, 15);
g2d.fillOval( (int)_startPosX + 45, (int)_startPosY + 60, 35, 15);
g2d.fillOval( (int)_startPosX + 45, (int)_startPosY + 95, 35, 15);
g2d.fillOval( (int)_startPosX + 50, (int)_startPosY + 115, 30, 15);
}
_startPosY += 25;
super.DrawTransport(g);
_startPosY -= 25;
if (warplane.GetWeapons())
{
g2d.fillRect((int)_startPosX + 40,(int) _startPosY + 20, 30, 5);
g2d.fillRect( (int)_startPosX + 40, (int)_startPosY + 140, 30, 5);
}
}
}