int countera=0;
public void act()
{
int guyX = ((guy) getWorld().getObjects(guy.class).get(0)).getX();
int guyY = ((guy) getWorld().getObjects(guy.class).get(0)).getY();
double a=abs(getX()-guyX);
double b=abs(getY()-guyY);
double c=sqrt(pow(a,2)+pow(b,2));
double sinal=abs(a/c);
int alfa=(int)(toDegrees(asin(sinal)));
if(guyX<getX()&&guyY>=(getY())){
alfa=alfa+90;
}
if(guyX<getX()&&guyY<getY()){
alfa=alfa+180;
}
if(guyX>=getX()&&guyY>=getY()){
}
if(guyX>=getX()&&guyY<getY()){
alfa=alfa+270;
}
if(countera<=1){
setRotation(alfa);
}
move(1);
if(isTouching(guy.class)||isAtEdge()){
getWorld().removeObject(this);
}
countera++;
}
SO I was trying to make my Mushroom thing shoot green things at the player.
I wanted the green balls to rotate so they fly towards him. Well now it seems that I can only use degrees that are divisible by 45...
What do I do now?
btw the "countera" is there so it turns only once, if i remove it the thing will follow the player around, and that works fine I think.

