dev4ltar wrote...
is there a way to make it more smoother to place the canon to 0 degree and 300?private void canonMove()
{
// initial rotation
int oldRot = getRotation();
if (oldRot == 0) oldRot = 360;
// target
MouseInfo mouse = Greenfoot.getMouseInfo();
int y = mouse.getY();
if (y > getY()) setRotation(0); else turnTowards(mouse.getX(), y);
if (getRotation() < 300 && getRotation() != 0) setRotation(300);
// new target rotation
int newRot = getRotation();
if (newRot == 0) newRot = 360;
// change direction
int direction = (int)Math.signum(newRot-oldRot);
if (oldRot == 300 && direction < 0 || oldRot == 360 && direction > 0) direction = 0; // limiting when to change angles
setRotation(oldRot+direction);
}
