Beispiel #1
0
 // Constructors
 public Astronaut(GameWorld gw) {
   super(gw);
   this.setSize(R.nextInt(MIN_SIZE, MAX_SIZE));
   this.setDirection(R.nextInt(MIN_DIRECTION, MAX_DIRECTION));
   this.setSpeed(MIN_SPEED);
   this.setColor(DEFAULT_COLOR);
   this.setHealth(DEFAULT_HEALTH);
 }
Beispiel #2
0
 public void Run(ISpaceNotifier notifier) {
   RunningDistance = 0;
   int distance = R.nextInt(100);
   for (int i = 0; i < distance; i = i + Speed) {
     notifier.Notify(Speed);
     RunningDistance += Speed;
   }
 }
Beispiel #3
0
 public void Walk(ISpaceNotifier notifier) {
   RunningDistance = 0;
   int distance = R.nextInt(100);
   for (int i = 0; i < distance; i = i + 5) {
     notifier.Notify(5);
     RunningDistance += 5;
   }
 }