i try to make pause button that have continue and menu button, but the continue button not working.
when player click pause button new world will pop up and show continue and menu button...
when player click continue i like to player continue where they stop.
pause world
pause button that has at level1
continue button that has at pause world
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class pauseWorld here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Pau extends World
{
/**
* Constructor for objects of class pauseWorld.
*
*/
public World lastWorld;
public Pau(World world)
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(500, 550, 1);
lastWorld = world;
prepare();
}
public World getLastWorld()
{
return lastWorld;
}
public void prepare()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
addObject(new PauseMenu(),300,215);
addObject(new sambung(),270,230);
addObject(new smbg(),420,200);
addObject(new menusemula(),270,230);
addObject(new msb(),420,265);
}
}
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Pause here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Pause extends Actor
{
/**
* Act - do whatever the Pause wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
if (Greenfoot.mouseClicked(this))
{
World world;
world = getWorld() ;
Greenfoot.setWorld(new Pau(getWorld()));
}
}
}
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class smbg here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class smbg extends sambung
{
/**
* Act - do whatever the smbg wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
if (Greenfoot.mouseClicked(this))
{
// get reference to Q world object
Pau pauWorld = (Pau)getWorld();
Greenfoot.setWorld(pauWorld.getLastWorld());
}
}
}
