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

2012/12/19

Can the world detect objects?

Entity1037 Entity1037

2012/12/19

#
So I need the world to detect if an actor is present, and if it is, it will exit the menu screen and spawn the game screen. Is there a way for the world to detect objects, and if not, how do I change the variables in the world to activate the game screen?
danpost danpost

2012/12/19

#
If you had looked at the Greenfoot documentation of the World class API, you would have found two methods, 'getObjects' and 'getObjectsAt', that return lists. By specifying the appropriate class and checking to see if the list returned is empty or not, one can determine if an object of a class is present or not.
Entity1037 Entity1037

2012/12/19

#
Thank you!
You need to login to post a reply.