I want to change the worlds background by pressing left or right, but it doesnt work
What do i have to change
public void auswahl()
{
if(auswahl == 0)
{
if(Greenfoot.isKeyDown("right"))
{
auswahl = 1;
}
if(Greenfoot.isKeyDown("left"))
{
auswahl = 1;
}
}
if(auswahl == 1)
{
if(Greenfoot.isKeyDown("right"))
{
auswahl = 0;
}
if(Greenfoot.isKeyDown("left"))
{
auswahl = 0;
}
}
}
public boolean enter()
{
if(Greenfoot.isKeyDown("enter"))
{
return true;
}
else
{
return false;
}
}
public void act()
{
if(start == 0)
{
if(auswahl == 1)
{
setBackground("mainmenu2.jpg");
if(enter() == true)
{
setBackground("sand2.png");
start = 1;
populate();
}
}
if(auswahl == 0)
{
setBackground("mainmenu.jpg");
}
auswahl();
}
