From 79ad67c00ff26d642aa323400c3129d82a9a59b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D0=B5=D0=BC=20=D0=A5=D0=B0=D1=80=D0=BB?= =?UTF-8?q?=D0=B0=D0=BC=D0=BE=D0=B2?= Date: Sat, 17 Dec 2022 22:11:24 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D0=B0-=D1=81=D1=83?= =?UTF-8?q?=D1=89=D0=BD=D0=BE=D1=81=D1=82=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EntityStormtrooper.java | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 EntityStormtrooper.java diff --git a/EntityStormtrooper.java b/EntityStormtrooper.java new file mode 100644 index 0000000..4119e90 --- /dev/null +++ b/EntityStormtrooper.java @@ -0,0 +1,33 @@ +import java.awt.Color; +import java.util.Random; + +public class EntityStormtrooper { + private int Speed = 0; + + private float Weight = 0; + + private Color BodyColor; + + public float Step; + + public int getSpeed() { + return Speed; + } + + public float getWeight() { + return Weight; + } + + public Color getBodyColor() { + return BodyColor; + } + + public void Init(int speed, float weight, Color bodyColor){ + Random rnd = new Random(); + Speed = speed <= 0 ? rnd.nextInt(50 + 1) +50 : speed; //генерация в диапазоне от 50 до 100 + Weight = weight <= 0 ? rnd.nextInt(50 + 1) +50 : weight; + Step = Speed * 100 / Weight; + BodyColor = bodyColor; + } +} +