diff --git a/src/main/java/DrawingArmoredCar.java b/src/main/java/DrawingArmoredCar.java index b4fa674..a3bd38b 100644 --- a/src/main/java/DrawingArmoredCar.java +++ b/src/main/java/DrawingArmoredCar.java @@ -22,9 +22,8 @@ public class DrawingArmoredCar { return armoredCar; } - public void Init(int speed, float weight, Color bodyColor) { - this.armoredCar = new EntityArmoredCar(); - this.armoredCar.init(speed, weight, bodyColor); + public DrawingArmoredCar(int speed, float weight, Color bodyColor) { + this.armoredCar = new EntityArmoredCar(speed, weight, bodyColor); Random r = new Random(); this.drawingCaterpillar = new DrawingCaterpillar(); this.drawingCaterpillar.Init(r.nextInt(4, 7), bodyColor); diff --git a/src/main/java/EntityArmoredCar.java b/src/main/java/EntityArmoredCar.java index f1d54e5..4ad1d9f 100644 --- a/src/main/java/EntityArmoredCar.java +++ b/src/main/java/EntityArmoredCar.java @@ -7,7 +7,7 @@ public class EntityArmoredCar { private Color bodyColor; public float step; - public void init(int speed, float weight, Color bodyColor) { + public EntityArmoredCar(int speed, float weight, Color bodyColor) { this.speed = speed; this.weight = weight; this.bodyColor = bodyColor; diff --git a/src/main/java/FormArmoredCar.java b/src/main/java/FormArmoredCar.java index 045cdaa..923ab88 100644 --- a/src/main/java/FormArmoredCar.java +++ b/src/main/java/FormArmoredCar.java @@ -42,8 +42,7 @@ public class FormArmoredCar extends JFrame{ @Override public void actionPerformed(ActionEvent actionEvent) { Random rnd = new Random(); - armoredCar = new DrawingArmoredCar(); - armoredCar.Init(rnd.nextInt(100,300), rnd.nextInt(1000, 2000), + armoredCar = new DrawingArmoredCar(rnd.nextInt(100,300), rnd.nextInt(1000, 2000), new Color(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256))); armoredCar.SetPosition(rnd.nextInt(10, 100), rnd.nextInt(10, 100),