What does the method pause() do ?
18 Replies - 431 Views - Last Post: 06 December 2012 - 03:26 PM
#16
Re: I'm unable to access a member from an object properly
Posted 06 December 2012 - 08:40 AM
#17
Re: I'm unable to access a member from an object properly
Posted 06 December 2012 - 10:53 AM
pbl, on 06 December 2012 - 04:40 PM, said:
What does the method pause() do ?
From this page:
http://jtf.acm.org/j...dent/index.html
it says:
“ public void pause (double milliseconds)
Delays the calling thread for the specified
time, which is expressed in milliseconds.
Unlike Thread.sleep, this method never
throws an exception.
Usage: program.pause(milliseconds);
Parameter: milliseconds The sleep time in milliseconds ”
#18
Re: I'm unable to access a member from an object properly
Posted 06 December 2012 - 11:15 AM
so as your delay can go to 0.05 and you pause(delay * 100) it means that you may sleep 5 millisecond which is completly but really completly useless
A CRT is refresh 60 times a second (in North America, 50 times inm Europe) so every 16.66666 milliseconds.
so with a delay of 0.05 you have the time to play 3 game turns before the CRT is actually refreshed. That is why your game seems slow, it is just that you just don't see it pass by and you see only one turn out of 3.
Your shortest delay should be 0.18 which means 0.18 * 100 18 millisecond which let your computer the time to play a turn and refresh the CRT.
Happy coding
A CRT is refresh 60 times a second (in North America, 50 times inm Europe) so every 16.66666 milliseconds.
so with a delay of 0.05 you have the time to play 3 game turns before the CRT is actually refreshed. That is why your game seems slow, it is just that you just don't see it pass by and you see only one turn out of 3.
Your shortest delay should be 0.18 which means 0.18 * 100 18 millisecond which let your computer the time to play a turn and refresh the CRT.
Happy coding
#19
Re: I'm unable to access a member from an object properly
Posted 06 December 2012 - 03:26 PM
pbl, on 06 December 2012 - 07:15 PM, said:
so as your delay can go to 0.05 and you pause(delay * 100) it means that you may sleep 5 millisecond which is completly but really completly useless
A CRT is refresh 60 times a second (in North America, 50 times inm Europe) so every 16.66666 milliseconds.
so with a delay of 0.05 you have the time to play 3 game turns before the CRT is actually refreshed. That is why your game seems slow, it is just that you just don't see it pass by and you see only one turn out of 3.
Your shortest delay should be 0.18 which means 0.18 * 100 18 millisecond which let your computer the time to play a turn and refresh the CRT.
Happy coding
A CRT is refresh 60 times a second (in North America, 50 times inm Europe) so every 16.66666 milliseconds.
so with a delay of 0.05 you have the time to play 3 game turns before the CRT is actually refreshed. That is why your game seems slow, it is just that you just don't see it pass by and you see only one turn out of 3.
Your shortest delay should be 0.18 which means 0.18 * 100 18 millisecond which let your computer the time to play a turn and refresh the CRT.
Happy coding
thanks
|
|

New Topic/Question
Reply




MultiQuote


|