Hello everyone
I have a problem with this piece of code. My animation should change sometimes a text.
I made in my constructor class Rechtecke a reference to world with also a field world.
But I always get a Nullpointer Exception, but I can' t understand it.
Thanks a lot for your help
Mario
import greenfoot.*;
public class Rechtecke extends Actor
{
private int r,g,b;
private World world;//Reference zu World;
public Rechtecke()
{
GreenfootImage image = new GreenfootImage(450,300);
image.setColor(new Color(255,0,0,255));
image.fillRect(0, 0, 450, 300);
this.setImage(image);
//causes Nullpointer Exception
world = this.getWorld();
world.showText("Hello World", 50, 50);
}
