Hi . I am trying to develop a small 2d game . I use Timer and TimerTask for the “bad guys” movement . The only problem is that I want them to move only while they are on the screen . The problem is that if I use cancel() on the Timer(each monster has its own Timer) and then try to schedule again the movement if I come back to “visit” the bad guy I get an exception that tells me that I already scheduled or canceled the Timer.Even if i initialize the Timer again each time I get the same error. How this should be done ? ???
Thanks in advance.

. Maybe if I rotate this in the developing stage and get the bounding polygon for the rotated image … The algoritm just checks if polygon 1 contains any of the polygon 2 points . If it does then they collide. The math sollution for the rotation it might a bit slow if you need to rotate the sprite too many times . I didn’t used too much java2d ,but I guess the rotation is around the center of the image.So all you have to do is to change the coordinates of each point of the polygon by rotating it with an angle. This should be easy done by using sinus and cosinus . I will leave for some days . I will continue the game and answer any other questions when I’m back . Bye.
. There are no distances that long to completly pass a part of another polygon . The method is not really independent of rotation , but you can get the new coordinates with some math .