I'm coding a program to move a player on the screen,
but the program directly show me the end,
which is my player reach the end point,
the animation part dose not display,
just like the player straight away jump to the end.
how can i modify my code to show the movement of the player?
here is my run function,
i use button click to start the animationCode:Thread t; public void run() { while (isClick) { try { int j = playerStep + 40; while(playerStep < j) { try { playerStep += 10; repaint(); t.sleep(300); } catch (InterruptedException err) { JOptionPane.showMessageDialog(null, "Moving error!"); } } } catch (InterruptedException err) { JOptionPane.showMessageDialog(null, "Drawing error!"); } isClick = false; repaint(); } }
thanks a lot


Reply With Quote


Bookmarks