some Where in the code below there is an error that tells the world that the player has bought the barriers when they only move the mouse over the button
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Button4 here. * * @author (your name) * @version (a version number or a date) */ public class Button4 extends Store { private boolean isHovering; public static boolean e; /** * Act - do whatever the Button4 wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { Bought(); } public void Bought() { if(!isHovering && Greenfoot.mouseMoved(this) && getWorld().getObjectsAt(497, 205, Pic4.class).isEmpty()) { isHovering = true; if( e == true) { getWorld().addObject(new Purchased(),497,205); } getWorld().addObject(new Pic4(),497,205); } if (isHovering && Greenfoot.mouseMoved(null) && !Greenfoot.mouseMoved(this)) { getWorld().removeObjects(getWorld().getObjectsAt(497,205, Pic4.class)); if( e == true) { getWorld().removeObjects(getWorld().getObjectsAt(497,205, Purchased.class)); } isHovering = false; } if(Greenfoot.mouseClicked(this)) { if(Cannon.score >= 10000) { if(e == false) { e = true; Atmosphere.boughtBarriers = true; Cannon.score = Cannon.score - 10000; } } } } }