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

2016/11/18

cannot remove intersecting object

taikvcing taikvcing

2016/11/18

#
i want to remove brick object that intersecting with the crusher. but my code it's not working. am i doing this wrong? i'm new on greenfoot and java.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
private Actor collide;
     
    public void act()
    {
        // Add your action code here.
        destroy();
    }
     
    public void destroy()
    {
        collide = getOneIntersectingObject(bata.class);
        if(collide != null){
            getWorld().removeObject(this);
        }
    }
Super_Hippo Super_Hippo

2016/11/18

#
If you want to remove the other intersecting object, you may try to use 'collide' instead of 'this' in line 13.
taikvcing taikvcing

2016/11/19

#
here some screenshot. i named my brick to bata (in my language bata mean brick ;) )
Super_Hippo wrote...
If you want to remove the other intersecting object, you may try to use 'collide' instead of 'this' in line 13.
i have tried it. but still not work
danpost danpost

2016/11/19

#
taikvcing wrote...
here some screenshot
Need image URLs. No permission to access uploaded data pages.
taikvcing taikvcing

2016/11/20

#
danpost wrote...
taikvcing wrote...
here some screenshot
Need image URLs. No permission to access uploaded data pages.
here is the URL screenshot 1 screenshot 2
danpost danpost

2016/11/20

#
Looks like a 3-d issue. Try having the crusher remove the brick when the crusher is down to a certain point instead of using solely collision detection. You can use the height of the brick as the amount of distance the crusher is to the platform to determine when the brick is destroyed.
You need to login to post a reply.