Hey everyone! I need a bit of help with my code to click buttons and change worlds. Here is what I have: it does not work correctly
import greenfoot.*;
/**
* Write a description of class HydraButton here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class HydraButton extends Actor
{
public int button;
/**
* Act - do whatever the HydraButton wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
MouseInfo mouse = Greenfoot.getMouseInfo();
if(mouse!=null)
{
button = mouse.getButton();
if(button == 1 && Greenfoot.mouseClicked(null))
{
if(mouse.getY() == getY() && mouse.getX() == getX())
{
World hydraboss = new HydraBoss();
Greenfoot.setWorld(hydraboss);
}
}
}
}
}


