I want to make a pause after an event. But when I use Thread.Sleep(1000), it also stops the code above. For example:
attackButton.setOnAction(e -> {
int playerAttack = player.getAtt();
mob.setHP(playerAttack);
mobHPLabel.setText(mob.getHP() + " HP");
eventTextArea.appendText("You dealt " + playerAttack + " damage to the " + mob.getEntityClass() + "\n");
Layout.setTextAreaFont(eventTextArea, "black", 15);
try {
Thread.sleep(1000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
mobTurn();
});
This is just a small part of my code, but the problem is here. The "Thread.sleep(1000)" doesn't only delay 'mobTurn()' which it's supposed to do. It also stop the code above, "event.TextArea.appendText(..."