Original Post
Hello, I am making fighting java game, and I have one problem, when I press attack key, enemy must respond and also attack player, I know how to do it, but I need to make a short delay between actions, player attack action must be performed immediately, and enemy must attack only after one second, how to make such thing?
Sample code on playerEnemy:
Sample code on playerEnemy:
public void keyPressed(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_ENTER) {
attack();
}
}