Im wanting to get an Actor that I spawned in one world to transfer to the next world when I use Greenfoot.setWorld. When I click the button to choose the arena I want to play on it removes my selected characters from the game when going to the next world. How do you code it to where certain actors stay.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.*;
/**
* Write a description of class SeaWorldButton here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class SeaWorldButton extends Button
{
public static int WorldSelector = 1;
public SeaWorldButton()
{
super("Play");
x = 25;
y = 100;
label = "SeaWorld Arena";
WIDTH = 200;
HEIGHT = 200;
ink = Color.blue;
FONT_SIZE = 20.0f;
bckg = Color.black;
makeImage();
setting = 1;
}
public void act()
{
if(Greenfoot.mouseClicked(this))
{
Greenfoot.setWorld(new SeaWorldLevel());
}
}
}
