Borschevskaya A.A. Lab Work 2 Hard #2

Merged
eegov merged 16 commits from lab2 into lab1 2022-11-07 10:48:13 +04:00
Showing only changes of commit 4d09e5187d - Show all commits

View File

@ -12,9 +12,9 @@ public class DrawingArmoredCar {
private int pictureHeight;
private static final int carWidth = 80;
private int carWidth = 80;
private static final int carHeight = 50;
private int carHeight = 50;
private DrawingCaterpillar drawingCaterpillar;
@ -29,6 +29,12 @@ public class DrawingArmoredCar {
this.drawingCaterpillar.Init(r.nextInt(4, 7), bodyColor);
}
protected DrawingArmoredCar(int speed, float weight, Color bodyColor, int carWidth, int carHeight) {
this(speed, weight, bodyColor);
this.carWidth = carWidth;
this.carHeight = carHeight;
}
public void SetPosition(int x, int y, int width, int height) {
if (x >= 0 && y >= 0 && x + carWidth < width && y + carHeight < height) {
startPosX = x;