davmac wrote...
The second one.
private World previousWorld;
public Counter_3(World world)
{
super(...); // keep this line from the original constructor!
previousWorld = world;
// add anything here from the original constructor
}
Greenfoot.setWorld(previousWorld);
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 Main_Menu extends World
{
public int countdowndelay = 32;
public int countdownteller = countdowndelay;
public int enterdelay = 100;
public int enterteller = enterdelay;
Press_Enter0 Enter0 = new Press_Enter0();
Press_Enter1 Enter1 = new Press_Enter1();
Press_Enter2 Enter2 = new Press_Enter2();
Press_Enter3 Enter3 = new Press_Enter3();
public int stardelay = 15;
public int starteller = stardelay;
GreenfootSound menu = new GreenfootSound("menu.mp3");
/**
* Constructor for objects of class Countdown1.
*
*/
public Main_Menu()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(480, 800, 1);
}
public void act(){
menu.play();
menu.setVolume(100);
Proceed();
if (countdownteller > 0) {
countdownteller--;
}
if (countdownteller == 11) {
PressEnter0();
}
if (countdownteller == 10) {
removeObject(Enter0);
PressEnter1();
}
if (countdownteller == 9) {
removeObject(Enter1);
PressEnter2();
}
if (countdownteller == 8) {
removeObject(Enter2);
PressEnter3();
}
if (countdownteller == 4) {
removeObject(Enter3);
PressEnter2();
}
if (countdownteller == 3) {
removeObject(Enter2);
PressEnter1();
}
if (countdownteller == 2) {
removeObject(Enter1);
PressEnter0();
}
if (countdownteller == 1) {
removeObject(Enter0);
}
if (countdownteller == 0) {
countdownteller = countdowndelay;
}
}
public void PressEnter0() {
addObject(Enter0,240,600);
}
public void PressEnter1() {
addObject(Enter1,240,600);
}
public void PressEnter2() {
addObject(Enter2,240,600);
}
public void PressEnter3() {
addObject(Enter3,240,600);
}
public void Proceed(){
if (Greenfoot.isKeyDown("space")){
Greenfoot.setWorld(new Intro());
menu.stop();
}
}
}import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Intro here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Intro extends World
{
int introtimer = 1300;
public Intro()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(480, 800, 1);
}
public void act()
{
if (introtimer > 0){
introtimer--;
}
if (introtimer == 1200){
setBackground("Intro0.png");
}
if (introtimer == 1000){
setBackground("Intro1.png");
}
if (introtimer == 800){
setBackground("Intro2.png");
}
if (introtimer == 600){
setBackground("Intro3.png");
}
if (introtimer == 400){
setBackground("Intro4.png");
}
if (introtimer == 200){
setBackground("Intro5.png");
}
if (introtimer == 0){
Greenfoot.setWorld(new BackgroundLvL1());
}
}
}