Hello, I'm fairly new to Greenfoot and have been trying to get an enemy to follow the main character, kara, when in a certain radius for the past two hours with no luck. Is there any chance someone can help me out?
Here's the code for the main character that is relevant:
public int returnX(){
return getX();
}
public int returnY(){
return getY();
}
public int returnAngle(){
return getRotation();
}
And here's what I have for the enemy as of now that is relevant:
public void act()
{
moveAndTurn();
touch();
}
public void moveAndTurn(){
turnTowards​(kara.getX(), kara.getY());
move(1);
}
This is definitely some fundamental understanding that I don't understand so I'm hoping someone can help me out. Thanks!
