From 5606591132f9eccdc484cbedb7d6072dd822f3a4 Mon Sep 17 00:00:00 2001 From: Senju Date: Fri, 23 Sep 2022 09:06:38 +0400 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=BF=D0=BE=D0=BB=D0=BD=D0=B8?= =?UTF-8?q?=D0=BB=D0=B0=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=20EntityWarship?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/EntityWarship.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/EntityWarship.java b/src/EntityWarship.java index bfa12b0..c3fc3c4 100644 --- a/src/EntityWarship.java +++ b/src/EntityWarship.java @@ -1,5 +1,29 @@ package src; +import java.awt.*; +import java.util.Random; + public class EntityWarship { + private int Speed; + private void setSpeed(int speed){this.Speed = speed;} + public int getSpeed(){return Speed;} + + private float Weight; + private void setWeight(float weight){this.Weight = weight;} + public float getWeight(){return Weight;} + + private Color BodyColor ; + private void setBodyColor (Color bodyColor){this.BodyColor = bodyColor;} + public Color getBodyColor (){return BodyColor;} + + public float Step; + public void Init(int speed, float weight, Color bodyColor) + { + Random rnd = new Random(); + Speed = speed <= 0 ? rnd.nextInt(100) + 50 : speed; + Weight = weight <= 0 ? rnd.nextInt(30)+40 : weight; + BodyColor= bodyColor; + Step = Speed * 100 / Weight; + } }