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

2021/5/14

if actor.class && actor.class isTouching("class".class), then...

Gallier Gallier

2021/5/14

#
How can i write in MyWorld, if 2 Actors both touching an Object, then... Do you know what i mean?
Super_Hippo Super_Hippo

2021/5/14

#
The “isTouching” method is protected, so you can’t access it from the World. You could “cheat” and create a public method which does the same thing. The alternative is to have the code in the object which both actors should touch.
if (isTouching(Actor1.class) && isTouching(Actor2.class))
{
    ((MyWorld) getWorld()).doSomething();
}
You need to login to post a reply.