Добавление второго конструктора
This commit is contained in:
parent
b74e5b9fba
commit
4d09e5187d
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user