this is my code, I have to make the fish move diagonally and make it reflect off edges which it does except the top edge of the world.
Heres my code so far:
public void turnAtEdge(){
if(isAtEdge()){
int t=getRotation();
int u=360-t;
//setRotation(u);
getRotation();
int x=getX();
int y=getY();
if (x>=0 ||x==getWorld().getWidth()){
int u2=270-u;
setRotation(u2);
}else if(y==0){
//int u3=u-210;
//turn(u3);
setRotation(u-120);
}
else{
setRotation(u);
}
move(2);
}