One other thing (and this is just me being extremely picky) with scenarios like this it makes sense to have the speed at 100% since the faster the speed the smoother the movement. Just a small tip :)
My mistake - to avoid confusing people, the comment:
//Get the value in radians and cast to an int
shouldn't have the int cast bit in, that's not done until the last line. Not very awake today!
Hi :)
The problem is in your getRotationToPoint method - it doesn't quite do what you want all the time. There's also a much shorter (and simpler) way of accomplishing it - there's a method in the Math class called atan2, and this returns the rotation based on the distance (in x and y values) from a certain point.
So if you replace the method with something like this:
//Get the distances to the mouse in x and y co-ordinates
int dX = x - getX();
int dY = y - getY();
//Get the value in radians and cast to an int
double rotation = Math.atan2(dY, dX);
//Convert to degrees
rotation = Math.toDegrees(rotation);
//Need to cast the double to an int
return (int)rotation;
..it should work as you want. The above can be condensed into a single line - I usually write it in 2 or 3 lines to avoid confusion, in this instance I've typed and commented the whole thing out fully so you can see what's going on.
2008/7/14
PointToMouse
2008/7/14
Mothra
2008/7/14
Reaction
2008/7/14
PointToMouse
2008/7/14
PointToMouse
2008/6/19
Hectic Helium Homicide
2008/6/17
DragonBallZ
2008/6/13
WLM - Sidestory of MM
2008/6/13
Java Final Game 1.1