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

2013/10/18

question on how to detect actor in the world

javanoob javanoob

2013/10/18

#
i want to make a program where when "r" is pressed and actor is existing in the world something does not happen, but when "r" is pressed and actor is not existing world does something. How do i do to make the world find/ detect actor in the world?
danpost danpost

2013/10/18

#
To see if no actor of a specific class is in the world, use 'getObjects(NameOfActorClass.class).isEmpty()'. Use the '!' in front to see if any actor of the class is in the world. From an Actor class prefix the method with 'getWorld().'.
javanoob javanoob

2013/10/19

#
thank you!!! XD it worked!
You need to login to post a reply.