OK. Change it back to 'public BackgroundLvL1()'. You will not be passing anything to this world. You will be passing this world through other worlds.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Countdown1 here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Countdown_Go extends World
{
public int countdowndelay = 40;
public int countdownteller = countdowndelay;
GreenfootSound go = new GreenfootSound("go.mp3");
private World previousWorld;
// add instance field
/**
* Constructor for objects of class Countdown1.
*
*/
public Countdown_Go()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(480, 800, 1);
go.play();
}
public void act(){
if (countdownteller > 0) {
countdownteller--;
}
if (countdownteller == 0) {
Greenfoot.setWorld(previousWorld);
}
}}// change line 20 to public Countdown_Go(World world) // and insert at line 24 previousWorld = world;
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Countdown1 here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Countdown3 extends World
{
public int countdowndelay = 40;
public int countdownteller = countdowndelay;
GreenfootSound beep = new GreenfootSound("beep.mp3");
/**
* Constructor for objects of class Countdown1.
*
*/
public Countdown3()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(480, 800, 1);
beep.play();
}
public void act(){
if (countdownteller > 0) {
countdownteller--;
}
if (countdownteller == 0) {
Greenfoot.setWorld(new Countdown2());
}
}}
on this line:
Greenfoot.setWorld(new Countdown3());