For a project I am making a memory game, but I am trying to make to objects disappear when the are equal. This is my code:
public void opencard(){
int duiker = 0;
int duiker2 = 0;
if (duiker == duiker2){
if(Greenfoot.mouseClicked(Duiker.class)){
setImage("duiker_tcm46-175501.jpg");
if(Greenfoot.mouseClicked(duiker2)){
duiker2 = 1;
}
duiker = 1;{
getWorld().removeObject(this);
}
}
else if(Greenfoot.mouseClicked(this)){
setImage("duiker_tcm46-175501.jpg");
Greenfoot.delay(150);
setImage("150px_RGB_WEBSAFE_D_B_G_26-29652.gif");
}
}
}
But they disappear even when I don't click on them.