Hi there,
I'm having problems trying to simulate the "OnmouseOver" event. I'd like when I put my mouse over an actor that the image change. I have tried a couple of things:
1º In the Actor part:
public void act()
{
MouseInfo mouse = Greenfoot.getMouseInfo();
Actor act = mouse.getActor();
if (act.equals(this) == true){
System.out.println("I'm over my actor");
}
}
But I get java.lang.NullPointerException
2º In the Actor part:
if (Greenfoot.mouseMoved(this) == true){
setImage("boton_gestion_registros_resaltado.png");
}else{
setImage("boton_gestion_registros.png");
}
But I don't have the correct effect (just change the image if i`m moving the mouse all the time over the actor...).
Any idea?? I¡m learning and it's hard at the first... :-)
Thanks,
Juan.