I've been rewriting a copy of the original Pokemon battle system in java.
hered my current code:

private void opTurn(){
//Todo: opponents random attack does random damage,
//misses, or causes a status effect
Action.setText("Tiffayoniton attacked!");
curPl -= 10;
plCur.setText("" + curPl);
private void A1MouseClicked(java.awt.event.MouseEvent evt) {                                
        if (fight == true) {
            if (curOp == 0) {
                Action.setText("Tiffayoniton fainted");
            } else {
                Action.setText("Pikachu used Thundershock");
                curOp -= 10;
                opCurrent.setText("" + curOp);


        if (item == true) {
            Action.setText("You threw a pokeball");

            //Action.setText("The pokeball missed");

p.pause references this:

public static void pause(int s, int m, int n){
//Thread.currentThread().sleep((s * 1000) + m, n);
//Thread.sleep((s * 1000) + m, n);

}catch(InterruptedException e){




public static void pause(int s, int m){

pause(s, m, 0);


public static void pause(int s){

pause(s, 0, 0);


public static void pause(){

pause(1, 0, 0);



no matter what ive tried it always pauses everything first(without displaying anything in the else statement) then skips to the end of opTurn instead of displaying the stuff in the else statement,pausing, then displaying the remainder of opTurn.

is there any way of getting this to work properly?

Try debugging your code to see what it is doing and why. Add lots of println() statements to follow logic flow and see how variables change.

This article has been dead for over six months. Start a new discussion instead.