Meaning it doesn't work is that the thread just doesn't go/stop if I take the Sys outs away.
The object of this method is to start a loop which it looks at my games System time and takes a snapshot of the current time and then designated time to time something for example if its 30secs game time and you want 5seconds of something to start or sleep it goes till 35secs then terminates.
TEtarget.GEStart(); is the TimerEvent classes calling to a Interface method GEStart which is passed through the constructor during initialization of the object. GeStart can be anything its just like Runnable.
if (TimeWizard.mainTimeSecs <= currTime) once false it = else and eventContinue to false ending the while loop.
Btw this is added to a thread.
1 2 3 4 5 6 7 8 9 10
| public void teGO() { new Thread(this).start();
}
@Override public void run() { this.startEvent();
} |
End result
1
| new TimedEvent(9,this).teGO(); |
Pretty much this class is a custom timer running by my games system time. Any entity or object can use this to trigger events because I have a method which tells once this is finished or not via TimerEvents method which other classes check.
1 2 3
| public boolean eventStatus() { return eventAlive; } |
You are able to pick a time to Run during the duration say for 5 seconds or choose to go after 5 seconds eventForDuration =true then it goes for the designated duration otherwise false it goes after the set duration.
So yea it appears my thread is just hanging for some reason.
EDIT: Solved..yea changing from a boolean to a void fixed things and just cleaning the code a bit, thanks guys UprigthPath good calls btw.