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

2019/5/24

Making an Object Disappear When Clicked

rb6333 rb6333

2019/5/24

#
I am trying to make an object disappear when it is clicked, but it wont work
excitedbubbles excitedbubbles

2019/5/24

#
Could you upload the code you already have?
rb6333 rb6333

2019/5/24

#
1
2
3
4
5
6
7
public void act()
    {
    if (Greenfoot.mouseClicked(this))
        {  
        getWorld().removeObject(this);
        }
    }
Super_Hippo Super_Hippo

2019/5/24

#
Make sure there isn't any other object on top of this object (including transparent parts of images).
itscarlwheezer itscarlwheezer

2019/5/24

#
The issue with your game is that the scope of the sniper covers the other image so you cannot click it. To fix this you want to make it remove the object when you click on specific coordinates, not on the object itself.
You need to login to post a reply.