I'm trying to make it so that the subclasses of Pet will follow my mouse when I drag it on them. I put super.act(); in the act method of each of the subclasses, but when I run the code it doesn't work. Not sure if I'm missing a step.
public class Pet extends Actor
{
/**
* Act - do whatever the Pet wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
movePet();
}
public void movePet()
{
if(Greenfoot.mouseDragged(Pet.class))
{
setLocation(Greenfoot.getMouseInfo().getX(), Greenfoot.getMouseInfo().getY());
}
}
}