Исправления в отрисовке

This commit is contained in:
prodigygirl 2022-10-23 17:26:58 +04:00
parent 4e3c6f6598
commit e2ac836193
2 changed files with 12 additions and 10 deletions

View File

@ -89,17 +89,19 @@ public class DrawingArmoredCar {
{
return;
}
// отрисовка корпуса и гусеницы
g2d.setPaint(armoredCar.getBodyColor());
g2d.fillRect((int ) startPosX + 20, (int) startPosY, 40, 20);
// отрисовка корпуса и гусеницы
int new_startPosX = Math.round(startPosX);
int new_startPosY = Math.round(startPosY);
g2d.fillRect(new_startPosX + 20, new_startPosY, 40, 20);
g2d.setPaint(Color.LIGHT_GRAY);
g2d.fillRect((int ) startPosX, (int ) startPosY + 20, 80, 20);
g2d.fillRect(new_startPosX, new_startPosY + 20, 80, 20);
g2d.fillOval((int ) startPosX, (int ) startPosY + 30, 20, 20);
g2d.fillOval((int ) startPosX + 80 - 20, (int ) startPosY + 30, 20, 20);
g2d.fillRect((int ) startPosX + 15, (int ) startPosY + 20, 60, 30);
g2d.fillOval(new_startPosX, new_startPosY + 30, 20, 20);
g2d.fillOval(new_startPosX + 80 - 20, new_startPosY + 30, 20, 20);
g2d.fillRect(new_startPosX + 15, new_startPosY + 20, 60, 30);
// отрисовка катков в гусенице
drawingCaterpillar.DrawCaterpillar(g2d, (int)startPosX, (int)startPosY);
drawingCaterpillar.DrawCaterpillar(g2d, new_startPosX, new_startPosY);
}
public void ChangeBorders(int width, int height)

View File

@ -3,7 +3,7 @@ import java.awt.*;
public class DrawingTank extends DrawingArmoredCar{
public DrawingTank(int speed, float weight, Color bodyColor, Color dopColor,
boolean towerWeapon, boolean AMachineGun) {
super(speed, weight, bodyColor);
super(speed, weight, bodyColor, 80, 60);
armoredCar = new EntityTank(speed, weight, bodyColor, dopColor, towerWeapon, AMachineGun);
}
@Override
@ -23,8 +23,8 @@ public class DrawingTank extends DrawingArmoredCar{
g.fillRect((int)startPosX + 60, (int)startPosY + 15, 7, 10);
g.fillRect((int)startPosX + 60, (int)startPosY + 17, 20, 5);
}
startPosY += 10;
startPosY += 5;
super.DrawTransport(g);
startPosY -= 10;
startPosY -= 5;
}
}