Click to See Complete Forum and Search --> : JAVA 15puzzle game problem~plz help


terry40
05-10-2006, 10:11 AM
JAVA 15puzzle game problem
i have do java 15puzzle game for the project
but i don't know how to add a time for player to show how long to play
and i want the player finish the game ~that will show a massage to show about the playing time and some words for player like"Thank you for playing the game"

plz help me

that's is my project link

http://hk.geocities.com/terryyu40/java1.zip

Khalid Ali
05-10-2006, 11:14 AM
did u try to make use of System.getTime in millisecs and date ?
NOTE: I am just pseudocoding here the correct syntax will be System.currentTimeMillis()

terry40
05-10-2006, 11:52 AM
Khalid Ali
thx your help
can you give more info for System.getTime
i hopy i can show i time for the player in the game right hand side
how can i do ?
Finally can show a massage to show about the playing time and some words for player like"Thank you for playing the game"

Khalid Ali
05-10-2006, 01:06 PM
there are several things that u can do.
1. display the start time. for this purpose using just new Date() will be good enough
2. if you want to show the time lapsed since user has started, then you will need to
use System.currentTimeMillis(); which will return a long value. Then any time
you want to show the difference, just current time at that time and diff it out
from the first time.