due to my other account called no_name being stuck with a pending request, i couldn't send any more discussions on that account until the devs reviewed it so i made a new account to asks questions. i am having an issue with removing the exit button when the resume button is clicked. here is the code:
pause button code:
import greenfoot.*;
public class Pause extends Actor
{
public Pause(String image) {
setImage(new GreenfootImage(image));
}
public void act() {
if (Greenfoot.mouseClicked(this)) {
Map1.isPaused = true;
Resume resume_button = new Resume("resume.png");
getWorld().addObject(resume_button,675,380);
ExitG e1 = new ExitG("exit.png");
getWorld().addObject(e1,675,450);
getWorld().removeObject(this);
//Greenfoot.setWorld(new Play()); // create world only when clicked
}
}
}
resume button code:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Resume here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Resume extends Actor
{
/**
* Act - do whatever the Resume wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public Resume(String image) {
setImage(new GreenfootImage(image));
}
public void act()
{
if (Greenfoot.mouseClicked(this)) {
Map1.isPaused = false;
Pause pause_button = new Pause("pause.png");
getWorld().addObject(pause_button,100,50);
getWorld().removeObject(this);
}
}
}
exit button code:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Exit here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class ExitG extends Actor
{
public ExitG(String image) {
setImage(new GreenfootImage(image));
}
public void act() {
if (Greenfoot.mouseClicked(this)) {
Greenfoot.setWorld(new Play());
getWorld().removeObject(this);
}
}
}
how do i make it so both the resume button and exit button disappear when the resume button is clicked.

