here’s that code
the game loop just in case the whole thing is the source of my issue
GameState is a object that holds three enum’s one for current, saved, and test.
the states get changed by other classes from Jbutton presses
while(done == false){
if(player.getHealth() <= 0){
System.out.println("player died is called");
gameOver();
break;
}
update();
}
the code in question
public void update(){
if(gameState.getCurrentGameState() == GameState.mainMenu){
}else if(gameState.getCurrentGameState() != gameState.getTestState()){
vc.removeObjectsFromChoiceArea();
System.out.println("states where different thus game direction should"
+ "be adjusted");
if(gameState.getCurrentGameState() == GameState.normal){
System.out.println(gameState.getCurrentGameState());
System.out.println("normal called");
//reminds the player where they are and rebuilds buttons
reestablishRoom();
gameState.setTestState(GameState.normal);
}else if(gameState.getCurrentGameState() == GameState.begining){
System.out.println(gameState.getCurrentGameState());
System.out.println(gameState.getTestState());
System.out.println("begining called");
gameState.setTestState(gameState.getCurrentGameState());
firstGo();
}else if(gameState.getCurrentGameState() == GameState.battle){
if(gameState.getSavedGameState() == GameState.battle){
battle.returnToBattle();
gameState.setSavedGameState(null);
}else{
battlePhase();
}
}else if(gameState.getCurrentGameState() == GameState.inventory){
gameState.setSavedGameState(gameState.getTestState());
gameState.setTestState(gameState.getCurrentGameState());
invent.go();
}else if(gameState.getCurrentGameState() == GameState.event){
gameState.setSavedGameState(gameState.getCurrentGameState());
gameState.setTestState(gameState.getCurrentGameState());
}
}else if(gameState.getCurrentGameState() == GameState.inventory){
}
in the else if statement with the first go present I’ve found the removing the
System.out.println(gameState.getCurrentGameState());
System.out.println(gameState.getTestState());
System.out.println("begining called");
gameState.setTestState(gameState.getCurrentGameState());
firstGo();
statments that the game never calls that branch I’m wonder is that because the System.out.println forces the threads to refocus? I haven’t made any explicit threads here but I’m using swing components which I believe do have threads in the background or something.
Any help is greatly appreciated. if I can make anything more clear let me know.