// WARNING: This file is auto-generated and any changes to it will be overwritten import lang.stride.*; import java.util.*; import greenfoot.*; /** * */ public class Imp extends Zwerg { private int count = 0; private int limit = Greenfoot.getRandomNumber(30); /** * Act - do whatever the Imp wants to do. This method is called whenever the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { if (count < limit) { this.move(Greenfoot.getRandomNumber(2)); count = count + 1; } else { this.turn(Greenfoot.getRandomNumber(4) - Greenfoot.getRandomNumber(4)); limit = Greenfoot.getRandomNumber(30); count = 0; } if (this.isAtEdge()) { this.turn(Greenfoot.getRandomNumber(90) + 90); } if (this.isTouching(Prinzessin.class)) { Greenfoot.playSound("kichern.wav"); this.setLocation(Greenfoot.getRandomNumber(this.getWorld().getWidth()), this.getWorld().getHeight()); } } }