I have an Actor here:
then I add this Actor to the world.
it shows error!
, pointing that addObject method.
must be that I can't do it like this.
but I use getWorld() to showText("like this string", X, Y) on an Actor, no error.
what error I made? thx.
point: Make this actor spawn an object like the World abstract does, but an actor did this.
1 2 3 4 5 6 | public class DoSomething extends Actor{ //constructor public DoSomething(){ getWorld().addObject( new otherObject, 100 , 100 ); } } |
1 | java.lang.NullPointerException |
1 | getWorld().showText( "Hello World" , 100 , 100 ); |