I've been searching all over the place for an answer, thought I'd come back to the source.
The following code is supposed to wait for the mouse to hover over an ore deposit, then display a label that shows the amount of ore there. But for the life of me, nothing is changing. No errors either so to the best of my knowledge the code should work.
Any ideas?
/**
* Tell us how much ore is left in this vein.
*/
private void Act(){
if (Greenfoot.mouseMoved(this) && info == null)
{
info = new Label(ore, 12);
MouseInfo mouse = Greenfoot.getMouseInfo();
getWorld().addObject(info, mouse.getX(), mouse.getY());
}
else if (Greenfoot.mouseMoved(null) && !Greenfoot.mouseMoved(this))
{
getWorld().removeObject(info);
info = null;
}
}
