// WARNING: This file is auto-generated and any changes to it will be overwritten import java.util.*; import greenfoot.*; /** * */ public class Gruenfisch extends Actor { private int booster = 300; private boolean spaceIstGedrueckt = false; /** * Act - do whatever the Gruenfisch wants to do. This method is called whenever the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { this.mouseChecken(); this.tastaturChecken(); this.getWorld().showText("Booster: " + this.boosterCheck(Greenfoot.getRandomNumber(100)), 250, 80); this.move(2); } /** * */ public void mouseChecken() { MouseInfo m = Greenfoot.getMouseInfo(); if (m != null) { this.turnTowards(m.getX(), m.getY()); } } /** * */ public void tastaturChecken() { if (Greenfoot.isKeyDown("space")) { this.spaceIstGedrueckt = true; if (this.booster > 0) { this.move(4); this.getWorld().showText("", this.getWorld().getWidth() / 2, this.getWorld().getHeight() / 2); } else { this.getWorld().showText("*** BOOSTER VERBRAUCHT ***", this.getWorld().getWidth() / 2, this.getWorld().getHeight() / 2); } } else { this.spaceIstGedrueckt = false; } } /** * */ public void setBooster(int booster) { this.booster = booster; } /** * */ public int getBooster() { return this.booster; } }