You are a genius! How do you know how to do all this?
// the Intro world class code
import greenfoot.*;
public class Intro extends World
{
private int groundedTimer;
public Intro()
{
super (600, 500, 1);
setPaintOrder(Rock.class, Rocket.class);
addObject(new Rocket(), 203, 441);
addObject(new Rock(),10 ,10 );
}
public void act()
{
timerOne();
}
private void timerOne()
{
if (groundedTimer<100 && ((Rock)getObjects(Rock.class).get(0)).isGrounded())
{
groundedTimer++;
if (groundedTimer==100)
{
addObject(new Turtle(), 203, 441);
addObject(new Skip(), 493, 132);
}
}
}
}
// the Menu (MainMenu) world class code
import greenfoot.*;
import java.awt.Color;
public class Menu extends World
{
private int platformSize;
public Menu()
{
super(600, 500, 1);
getBackground().setColor(Color.darkGray);
getBackground().fillOval(260, 211, 88, 82);
}
public void act()
{
if(platformSize<215)
{
platformSize++;
GreenfootImage platform = new GreenfootImage(2+2*platformSize/5, 2+2*platformSize/5);
platform.setColor(Color.lightGray);
platform.fillOval(0, 3, 2*platformSize/5, 2*platformSize/5-6);
getBackground().drawImage(platform, 304-platformSize/5, 252-platformSize/5);
}
}
}// the adjusted Turtle class code
import greenfoot.*;
public class Turtle extends Actor
{
private int timer = 100;
public void act()
{
if(getWorld() instanceof Intro)
{
if(timer==0)
{
move(2);
if(getRotation()==0 && getX()>=355) timer = 136;
if(getRotation()==180 && getX()<=202) Greenfoot.setWorld(new Menu());
}
else
{
timer--;
if(getX()>=355 && timer<36) setRotation(getRotation()-5);
}
}
}
}
// the revised Menu class code with the turtle on the platform
import greenfoot.*;
import java.awt.Color;
public class Menu extends World
{
private int platformSize;
private Turtle turtle = new Turtle();
private GreenfootImage turtleImage;
public Menu()
{
super(600, 500, 1);
getBackground().setColor(Color.darkGray);
getBackground().fillOval(260, 211, 88, 82);
turtleImage = turtle.getImage();
addObject(turtle, 306, 252);
}
public void act()
{
if(platformSize<215)
{
platformSize++;
GreenfootImage platform = new GreenfootImage(2+2*platformSize/5, 2+2*platformSize/5);
platform.setColor(Color.lightGray);
platform.fillOval(0, 3, 2*platformSize/5, 2*platformSize/5-6);
getBackground().drawImage(platform, 304-platformSize/5, 252-platformSize/5);
GreenfootImage turtleImg = new GreenfootImage(turtleImage);
double factor = (double)(2+2*platformSize/5)/86;
turtleImg.scale((int)(factor*62), (int)(factor*46));
turtle.setImage(turtleImg);
}
}
}Greenfoot.setWorld(new Level1(this)); // from the world class, or Greenfoot.setWorld(new Level1((MainMenu)getWorld())); // from an actor class
// add this instance field
private MainMenu mainMenu;
// add a secondary constructor
public MainMenu(MainMenu world)
{
this(); // calls the main constructor
mainMenu = world; // saves the menu world
}
// to return to the saved MainMenu world
Greenfoot.setWorld(mainMenu); // from the world classGreenfoot.setWorld(((Level)getWorld()).getMenuWorld());
public MainMenu getMenuWorld()
{
return mainMenu;
}public Level1(MainMenu world)