I see the change of scenes in println, but the scenes do not change!
I can not put in Loop, because in the different scenes I have movements and animations. - However even putting on Loop, it remains the problem of 1).
Do you know how to help yet? Where is the problem?
One very simple way to handle this is a switch statement to make your collection of functions callable by index.
void scene(int num){
switch(num) {
case 0:
scene0();
break;
case 1:
scene1();
break;
case 2:
scene2();
break;
}
}
Then you interact with them through a current_scene variable and calling the scene() switch. When you add new scenes, write a function and add it to the switch.
Another way to handle this problem is to use objects.
class Scene {
void run(){};
}
Now you can declare a new Scene and @override its run().
Instead of having hard-coded indexes, now you have a list of scenes:
Scene[] scenelist = new Scene[3];
Now you maintain the index, get your scene by index, and call .run() on it:
scenelist[current_scene].run()
This allows you to do things like shuffle the scene order, or add / remove / replace scenes based on game events. Since a Scene is an object, you could add properties like names, or timers, or board size, etc. to each scene. You could also use ArrayList for more flexibility.
ArrayList<Scene> scenelist = new ArrayList<Scene>;
// ...
scenelist.get(current_scene).run();