32 lines
685 B
Java
32 lines
685 B
Java
import java.awt.*;
|
|
import java.util.Random;
|
|
|
|
public class EntityShip {
|
|
private int speed;
|
|
private float weight;
|
|
private Color bodyColor;
|
|
|
|
public EntityShip(int speed, float weight, Color bodyColor) {
|
|
Random rnd = new Random();
|
|
this.speed = speed <= 0 ? rnd.nextInt(100) + 50 : speed;
|
|
this.weight = weight <= 0 ? rnd.nextInt(30) + 40 : 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;
|
|
}
|
|
}
|