I'm making a game where the hero moves by following the mouse but I can't figure it out.
public void act()
{
Greenfoot.getMouseInfo();
} public void act()
{
MouseInfo mouseInfo = Greenfoot.getMouseInfo();
int x = mouseInfo.getX();
int y = mouseInfo.getY();
setLocation(x,y);
} if (mouseInfo != null)