PIbd-23_Kharlamov_A.A._Stor.../DrawingMilitaryStormtrooper.java

37 lines
1.2 KiB
Java
Raw Normal View History

import java.awt.*;
public class DrawingMilitaryStormtrooper extends DrawingStormtrooper {
public DrawingMilitaryStormtrooper(int speed, float weight, Color bodyColor, Color dopColor, boolean bomb, boolean propeller) {
super(speed, weight, bodyColor, 135, 100);
Stormtrooper = new EntityMilitaryStormtrooper(speed, weight, bodyColor, dopColor, bomb, propeller);
}
@Override
public void DrawTransport(Graphics2D g) {
if(!(Stormtrooper instanceof EntityMilitaryStormtrooper storm))
{
return;
}
_startPosX += 2;
_startPosX -= 2;
super.DrawTransport(g);
EntityMilitaryStormtrooper entityStorm = (EntityMilitaryStormtrooper) Stormtrooper;
if (entityStorm.propeller)
{
g.setColor(entityStorm.dopColor);
g.fillOval((int)_startPosX - 2, (int)_startPosY +30, 5, 20);
g.fillOval((int) _startPosX - 2, (int)_startPosY + 50, 5, 20);
}
if (entityStorm.bomb)
{
g.setColor(Color.RED);
g.fillRect((int)_startPosX+95, (int)_startPosY + 30, 20, 10);
g.fillRect((int)_startPosX+95,(int) _startPosY + 60, 20, 10);
}
}
}