Hi,
I am trying to create an actor which would follow the mouse wherever it goes. It should be able to do so with and without the left button pressed down. The code I used was:
However, the code only worked when the left button is not pressed down. What are the problems and how can I fix them?
if(Greenfoot.mouseMoved(null)) { MouseInfo mouse = Greenfoot.getMouseInfo(); setLocation(mouse.getX(), mouse.getY()); }