Hi there. This is my first post on these forums and need some help with a for loop timer. What I want to happen is to have a for loop as a timer - every 100 steps it should end. What is happening is that either the for loop is being bypassed completely or executing every step. Code is as follows below.
In the "Timer" class:
And this is the method in my world class in which it is being called.
Any help would be greatly appreciated.
Thanks,
C
1 2 3 4 5 6 7 8 | public boolean runTimer( int userTimerLength) { for ( int timerLength = userTimerLength; timerLength > 0 ; timerLength--) { return false ; } return true ; } |
1 2 3 4 5 6 7 8 9 | public void addNewCars() { Timer timer = new Timer(); while (timer.runTimer( 100 )) { //Don't do stuff } addNewStuff(); } |