With the valuable advices from kind users, my trading card game is progressing. However, I’ve already got a new problem which is related to the way jME is rendering a scene.
I’ve got an AppState called “QuickGame” whose initialize method looks as follows:
[java]
@Override
public void initialize(AppStateManager stateManager, Application game) {
super.initialize(stateManager, game);
this.game = (SimpleApplication) game;
this.stateManager = stateManager;
setUpBoard();
setUpGrid();
setUpLights();
Camera camera = game.getCamera();
camera.setLocation(new Vector3f(14.5f, 0f, 10f));
camera.lookAt(new Vector3f(14.5f, 8f, 0f), new Vector3f(0f, 1f, 0f));
GameScreen gameScreen = new GameScreen((SimpleApplication) game, niftyDisplay);
stateManager.attach(gameScreen);
setUpDecks();
setUpHands();
}[/java]
I guess the calls are pretty self-explaining. E.g. setUpBoard() creates and textures the plane that represents the board of the game, so it adds graphical objects to the scene and displays them.
SetUpDecks() gets data from a JSON file and puts it in an ArrayList, so there’s no graphical stuff in there. SetUpHands() is the method that’s causing problems. It calls another method “drawCard()” that gets a card from an ArrayList called “playerDeck” and displays it on the screen. This method is called 5 times in the setUpHands() method and I’d like it to visualize the whole process by displaying a card, waiting a few moments, displaying the next card and so on. The problem is that all these things don’t happen visually because the screen remains black until everything’s done. I already tried to put the setUpHands() call in the update() method, but that didn’t work, either. I understand that jME probably processes the whole initialize() method before it actually renders anything on the screen, but I don’t know how to avoid this behavior and to force jME to first display the board and such stuff and then, afterwards, display those cards.
I hope you get the point, it’s always a bit difficult to formulate something like that in a foreign language. Thanks in advance for every kind of help!