I want the seahorse to rotate in a circle while always facing right, and not spinning while it moves.
import greenfoot.*;
public class Seahorse extends Actor {
private static final int RADIUS = 200;
private static final int ANGLE_INCREMENT = 1;
private int angle;
public Seahorse() {
setImage("seahorse.png");
angle = 0;
}
public void act() {
rotateAndMove();
}
private void rotateAndMove() {
setRotation(angle); // Set the rotation angle to face right
move(1);
angle += ANGLE_INCREMENT;
if (angle >= 360) {
angle = 0;
}
}
}