I'm trying to get the code to change the button's sprite from Play Button.png to an inverted version (Play Button 2.png) when I hover over it.
As a bonus, could you tell me how to switch to world InvestScreen after I click said button?
Here is my code at the moment:
import greenfoot.*;
public class PlayButton extends Actor
{
public void act()
{
GreenfootImage PlayButton = getImage();
PlayButton.scale(2800,2000);
}
public void OnMouseOver()
{
if (getX()>0)
{
if (getX()<250)
{
if(getY()>150)
{
if(getY()<400)
{
setImage("Play Button 2.png");
}
}
}
}
else
{
setImage("Play Button.png");
}
}
}

