Say my world class contains a variable x, how would I be able to update this variable from within an actor class? I have tried something like this:
However when I do this sort of method, I receive a null pointer exception. Is there something wrong with this method, or is there another way to change a world variable from within an actor?
1 2 3 4 5 6 7 8 9 | public class MyWorld extends World { public int worldVar; } public class actClass extends Actor { (MyWorld) getWorld().worldVar += 10 ; } |