When i click on "-", greenfoot must remove 1 object per click. But on the first click, 2 objects are removed, and than 1 per click.
I have no ideia what the problem is.
public void act() {
if (Greenfoot.mouseClicked(addButton))
{
MouseInfo mouseInfo = Greenfoot.getMouseInfo();
x += 30;
addObject(new Pessoa(), x, ALTURA/2);
}
if (Greenfoot.mouseClicked(removeButton)) {
MouseInfo mouseInfo = Greenfoot.getMouseInfo();
x -= 10;
removeObjects(getObjectsAt(x, ALTURA/2, Pessoa.class));
}
}
