This site requires JavaScript, please enable it in your browser!
Greenfoot back
nuggetnugget123
nuggetnugget123 wrote ...

2024/4/2

removing buttom

nuggetnugget123 nuggetnugget123

2024/4/2

#
hey i'am trying to make reflex clicker game but i have a actor called cirkel but can someone tell me what i have to do to make it dissapear
nuggetnugget123 nuggetnugget123

2024/4/2

#
sorry i meant Button
nuggetnugget123 nuggetnugget123

2024/4/2

#
and it has to dissapear when clicked
Bennylit Bennylit

2024/4/2

#
If you need it to be removed from the world upon a click, you can call
if (Greenfoot.mouseClicked(this)) {
        getWorld().removeObject(this);
}
wherever you need to check for it. However, you need to make sure you don't try to access anything about the world (location, which world the actor is in) after the button is deleted, or else you can get some exceptions. But the solution I provided should cover most situations. If you have trouble, please respond back.
nuggetnugget123 nuggetnugget123

2024/4/9

#
thanks i am going to try it
nuggetnugget123 nuggetnugget123

2024/4/9

#
thanks man it worked
You need to login to post a reply.