Im trying to build a graphic game (in java) that needs to move between worlds when the player reaches a specific point. Each world is represented by a class that extends GCanvas and the whole game is managed from the main class.
I start when the main class presents the first world. When the player reaches a certain point, it changes a variable within this world's class. I want the main class to monitor this variable and switch to the next world when this indicator becomes true. I assume that threads can be helpful, but am not sure how to do it and would like to get some help.
Thats the idea of the main class:
world1 = new GCWorld1();
add(world1);
/**when the player reaches the point (world1.getMoveWorldIndic())*/
remove(world1);
world2=new GCWorld2();
add(world2);
Thanks.