Fixed DrawningWarmlyLocomotive

This commit is contained in:
Данила Мочалов 2022-10-08 18:55:47 +04:00
parent 4526388454
commit b18173f05a
2 changed files with 18 additions and 10 deletions

View File

@ -100,7 +100,7 @@ class DrawningLocomotive {
} }
//тело //тело
g.setColor(Color.BLACK); g.setColor(Color.BLACK);
g.drawRect((int)_startPosX , (int)_startPosY, _locomotiveWidth - 20, _locomotiveHeight - 10); g.drawRect((int)_startPosX , (int)_startPosY, 110 - 10, 50 - 10);
//окна //окна
g.setColor(Locomotive.getBodyColor()); g.setColor(Locomotive.getBodyColor());
g.fillRect((int)_startPosX + 10, (int)_startPosY + 10, 10, 10); g.fillRect((int)_startPosX + 10, (int)_startPosY + 10, 10, 10);

View File

@ -2,29 +2,37 @@ import java.awt.*;
public class DrawningWarmlyLocomotive extends DrawningLocomotive{ public class DrawningWarmlyLocomotive extends DrawningLocomotive{
public DrawningWarmlyLocomotive(int speed, float weight, Color bodyColor, Color extraColor, boolean pipe, boolean storage) public DrawningWarmlyLocomotive(int speed, float weight, Color bodyColor, Color extraColor, boolean pipe, boolean storage)
{ {
super(speed, weight, bodyColor, 110, 50); super(speed, weight, bodyColor, 130, 70);
Locomotive = new EntityWarmlyLocomotive(speed, weight, bodyColor, extraColor, pipe, storage); Locomotive = new EntityWarmlyLocomotive(speed, weight, bodyColor, extraColor, pipe, storage);
} }
public void DrawTransport(Graphics g) @Override
public void DrawTransport(Graphics2D g)
{ {
if (Locomotive instanceof EntityWarmlyLocomotive) if (Locomotive instanceof EntityWarmlyLocomotive)
{ {
EntityWarmlyLocomotive warmlyLocomotive = (EntityWarmlyLocomotive) Locomotive; EntityWarmlyLocomotive warmlyLocomotive = (EntityWarmlyLocomotive) Locomotive;
//Pen pen = new(Color.Black);
//Brush extraBrush = new SolidBrush(warmlyLocomotive.ExtraColor); g.setColor(warmlyLocomotive.ExtraColor);
super.DrawTransport((Graphics2D)g);
if (warmlyLocomotive.Pipe) if (warmlyLocomotive.Pipe)
{ {
//TODO g.fillRect((int)_startPosX + 10, (int)_startPosY, 30, 20);
g.fillRect((int)_startPosX + 60, (int)_startPosY, 20, 20);
g.fillRect((int)_startPosX + 60, (int)_startPosY + 10, 30, 10);
} }
if (warmlyLocomotive.FuelStorage) if (warmlyLocomotive.FuelStorage)
{ {
//TODO g.fillRect((int)_startPosX + 110, (int)_startPosY + 10, 10, 50);
g.fillRect((int)_startPosX + 110, (int)_startPosY + 40, 20, 20);
g.fillRect((int)_startPosX + 110, (int)_startPosY, 30, 10);
}
} _startPosY += 20;
super.DrawTransport((Graphics2D)g);
_startPosY -= 20;
} }
} }
} }