Hi all,
I am writing a game for my first java program. I want to paint each time a loop executes with a small delay in between to create a cascade effect on screen. I believe that the effeciency routines in the system are collapsing the calls to repaint() into a single call. At any rate, the changes all occur at once after the total delay. Is there some way to force the system to repaint immediately and then delay on each iteration of the loop?
Here is the loop code:
Any suggestions would be appreciated.
I am writing a game for my first java program. I want to paint each time a loop executes with a small delay in between to create a cascade effect on screen. I believe that the effeciency routines in the system are collapsing the calls to repaint() into a single call. At any rate, the changes all occur at once after the total delay. Is there some way to force the system to repaint immediately and then delay on each iteration of the loop?
Here is the loop code:
Code:
for (row=row;row<gridRows-1;row++) {
if (row == gridRows - 1 || col == 0) break;
if (tiles[row+1][col-1] == null) break;
Tile14.move(tiles[row+1][col-1],tiles[row][col]);
repaint();
try {
Thread.sleep(200);
}
catch (InterruptedException e) {}
col--;
}
Tile14.move(holdTile,tiles[row][col]);
repaint();