From d0cfbc503d68c8b1523df772a5dd4c3ea6ace7a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B9=20=D0=9F=D0=BE=D0=BB?= =?UTF-8?q?=D0=B5=D0=B2=D0=BE=D0=B9?= Date: Sun, 25 Sep 2022 16:31:57 +0400 Subject: [PATCH] Added class EntityArtillery --- EntityArtillery.java | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 EntityArtillery.java diff --git a/EntityArtillery.java b/EntityArtillery.java new file mode 100644 index 0000000..4367dae --- /dev/null +++ b/EntityArtillery.java @@ -0,0 +1,31 @@ +import java.awt.*; +import java.util.Random; + +public class EntityArtillery { + private int speed; + private float weight; + private Color bodyColor; + + public void Init(int speed, float weight, Color bodyColor) { + Random rnd = new Random(); + this.speed = speed <= 0 ? rnd.nextInt(50, 150) : speed; + this.weight = weight <= 0 ? rnd.nextInt(40, 70) : weight; + this.bodyColor = bodyColor; + } + + public int getSpeed() { + return speed; + } + + public float getWeight() { + return weight; + } + + public Color getBodyColor() { + return bodyColor; + } + + public float getStep() { + return speed * 100 / weight; + } +}