my counter goes away when i get to the next level. please help it’s urgent.
public counter theCounter;
public Counter getCounter()
{ return theCounter; }
public void prepare() {
theCounter = new Counter();
addObject(new Counter(), 42, 485);
}
public Level5(){
prepare();}public static Counter theCounter; public static Counter getCounter() addObject(theCounter, 42, 485);
Counter theCounter = Level5.getCounter();
addObject(Level5.getCounter(), 42, 485);
import greenfoot.*;
import javax.swing.JOptionPane;
public class SignUp extends Actor
{
public void act()
{
if (Greenfoot.mouseClicked(this))
{
String uname1 = JOptionPane.showInputDialog("Please enter the first username.");
String uname2 = JOptionPane.showInputDialog("Please re-enter the first username.");
String pword1 = JOptionPane.showInputDialog("Please enter the first password.");
String pword2 = JOptionPane.showInputDialog("Please re-enter the first password.");
String uname3 = JOptionPane.showInputDialog("Please enter the second username.");
String uname4 = JOptionPane.showInputDialog("Please re-enter the second username.");
String pword3 = JOptionPane.showInputDialog("Please enter the second password.");
String pword4 = JOptionPane.showInputDialog("Please re-enter the second password.");
String uname5 = JOptionPane.showInputDialog("Please enter the third username.");
String uname6 = JOptionPane.showInputDialog("Please re-enter the third username.");
String pword5 = JOptionPane.showInputDialog("Please enter the third password.");
String pword6 = JOptionPane.showInputDialog("Please re-enter the third password.");
String uname7 = JOptionPane.showInputDialog("Please enter the forth username.");
String uname8 = JOptionPane.showInputDialog("Please re-enter the forth username.");
String pword7 = JOptionPane.showInputDialog("Please enter the forth password.");
String pword8 = JOptionPane.showInputDialog("Please re-enter the forth password.");
if(uname1.equals(uname2) & pword1.equals(pword2) & uname3.equals(uname4) & pword3.equals(pword4) & uname5.equals(uname6) & pword5.equals(pword6) & uname7.equals(uname8) & pword7.equals(pword8))
{
Greenfoot.setWorld(new Level2());
}
else Greenfoot.setWorld(new Level3());
}
}
}