I started with this:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class World1 here. * * @author (your name) * @version (a version number or a date) */ public class World1 extends World { /** * Constructor for objects of class World1. * */ public World1() { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super(500, 800, 1); this.addObject( new Todesfläche(), 250, 799); this.addObject( new Robber(), 250, 700); this.addObject( new Fläche(),250, 780); this.addObject( new PolizeiKanone() , 250, 74); randomSpawn(); } public void prepare() { Robber robber = new Robber(); Todesfläche todesfläche = new Todesfläche(); PolizeiKanone polizeikanone = new PolizeiKanone(); Fläche fläche = new Fläche(); } public void randomSpawn() { { if(Greenfoot.getRandomNumber(100) == 1) { int x = Greenfoot.getRandomNumber(400); int y = Greenfoot.getRandomNumber(300); addObject(new Fläche(), x, y); } } } }