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

49 lines
1.7 KiB
Java
Raw Normal View History

2022-12-13 21:37:45 +04:00
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, 100, 100);
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 + 15, 30, 15);
g2d.fillOval( (int)_startPosX + 45, (int)_startPosY + 35, 35, 15);
g2d.fillOval( (int)_startPosX + 45, (int)_startPosY + 70, 35, 15);
g2d.fillOval( (int)_startPosX + 50, (int)_startPosY + 90, 30, 15);
g2d.drawOval((int)_startPosX + 50, (int)_startPosY + 15, 30, 15);
g2d.drawOval((int)_startPosX + 45, (int)_startPosY + 35, 35, 15);
g2d.drawOval((int)_startPosX + 45, (int)_startPosY + 70, 35, 15);
g2d.drawOval((int)_startPosX + 50, (int)_startPosY + 90, 30, 15);
}
_startPosY += 25;
super.DrawTransport(g);
_startPosY -= 25;
if (warplane.GetWeapons())
{
g2d.fillRect((int)_startPosX + 40,(int) _startPosY, 30, 5);
g2d.fillRect( (int)_startPosX + 40, (int)_startPosY + 115, 30, 5);
g2d.drawRect((int)_startPosX + 40, (int)_startPosY, 30, 5);
g2d.drawRect((int)_startPosX + 40, (int)_startPosY + 115, 30, 5);
}
}
}