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

2017/5/22

Collision Detection

asthaga20 asthaga20

2017/5/22

#
Why does the following code not work:
        boolean collided = false;
        Actor onTop;
        onTop = getOneIntersectingObject(Vehicle.class);
        if(onTop != null)
        {
            collided = true;
        }
        if(collided)
            setLocation(Greenfoot.getRandomNumber(200)+200,650);
Super_Hippo Super_Hippo

2017/5/22

#
Is this code in the act method?
You need to login to post a reply.