Исправления

This commit is contained in:
prodigygirl 2022-10-22 18:37:02 +04:00
parent 2d676c0a0a
commit 72031baf42
2 changed files with 5 additions and 9 deletions

View File

@ -16,17 +16,16 @@ public class DrawingArmoredCar {
private static final int carHeight = 50;
private DrawningCaterpillar drawningCaterpillar;
private DrawingCaterpillar drawingCaterpillar;
public void Init(int speed, float weight, Color bodyColor) {
this.armoredCar = new EntityArmoredCar();
this.armoredCar.init(speed, weight, bodyColor);
Random r = new Random();
this.drawningCaterpillar = new DrawningCaterpillar();
this.drawningCaterpillar.Init(r.nextInt(4) + 3, bodyColor);
this.drawingCaterpillar = new DrawingCaterpillar();
this.drawingCaterpillar.Init(r.nextInt(4) + 3, bodyColor);
}
public void SetPosition(int x, int y, int width, int height) {
if (x > 0 && y > 0 && x + carWidth < width && y + carHeight < height) {
startPosX = x;
@ -36,7 +35,6 @@ public class DrawingArmoredCar {
}
}
public void MoveTransport(Direction direction) {
if (pictureWidth < 1|| pictureHeight < 1)
{
@ -75,7 +73,6 @@ public class DrawingArmoredCar {
}
}
public void DrawTransport(Graphics2D g2d)
{
if (startPosX < 0 || startPosY < 0
@ -93,10 +90,9 @@ public class DrawingArmoredCar {
g2d.fillOval((int ) startPosX + 80 - 20, (int ) startPosY + 30, 20, 20);
g2d.fillRect((int ) startPosX + 15, (int ) startPosY + 20, 60, 30);
// отрисовка катков в гусенице
drawningCaterpillar.DrawCaterpillar(g2d, (int)startPosX, (int)startPosY);
drawingCaterpillar.DrawCaterpillar(g2d, (int)startPosX, (int)startPosY);
}
public void ChangeBorders(int width, int height)
{
pictureWidth = width;

View File

@ -1,6 +1,6 @@
import java.awt.*;
public class DrawningCaterpillar {
public class DrawingCaterpillar {
private NumRinks numRinks = NumRinks.Four;
private Color color;