I'm using the Greenfoot program to create a game, but cannot instantiate anything in a constructor. For some reason, nothing is made when I write getWorld().addObject()
in the constructor.
I can create objects in the act()
method, though.
Since Greenfoot only allows you to add objects from a world object, the other actors you are calling don't exist yet. This means there are no constructors to call getworld()
on.