Borschevskaya A.A. Lab Work 1 Hard #1

Merged
eegov merged 9 commits from lab1 into master 2022-10-28 09:19:15 +04:00
2 changed files with 5 additions and 9 deletions
Showing only changes of commit 72031baf42 - Show all commits

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;