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

2022/10/9

Actor touching another actor

Guy68 Guy68

2022/10/9

#
if an actor touches an another actor i want to the game to send me to an another world
danpost danpost

2022/10/10

#
Guy68 wrote...
if an actor touches an another actor i want to the game to send me to an another world
This is the gist of it:
if (this.isTouching(AnotherActor.class)) Greenfoot.setWorld(new AnotherWorld());
Gabe1098 Gabe1098

2022/10/11

#
I'm pretty sure you can do this
if (isTouching(Actor.class)) {
     removeObject(this);
}
Gabe1098 Gabe1098

2022/10/11

#
oops I meant
if (isTouching(Actor.class)) {
     getWorld().removeObject(this);
}
Gabe1098 Gabe1098

2022/10/11

#
Gabe1098 wrote...
oops I meant
if (isTouching(Actor.class)) {
     getWorld().removeObject(this);
}
the remove object is just a place holder
danpost danpost

2022/10/11

#
Gabe1098 wrote...
I'm pretty sure you can do this << Code Omitted >>
Wanted was to go to another world -- not to remove an actor from the current world.
You need to login to post a reply.