I have a little problem, but I don`t manage it to solve.
I want to change the Background Image of MyWorld by clicking the Playing Area.
It works for one time, but I am not able to change the Image by every click. Also no error is shown ...
Thanks a lot for helping
public class MyWorld extends World
{
private GreenfootImage image2 = new GreenfootImage("board.jpg");
private GreenfootImage image1 = new GreenfootImage("brick.jpg");
public MyWorld()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1);
this.setBackground(image2);
}
public void act()
{
this.myClicking();
}
public void myClicking()
{
if(Greenfoot.mouseClicked(this))
{
if(this.getBackground().equals(image1))
{
this.setBackground(image2);
}
else
{
this.setBackground(image1);
}
}
}
}
