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

2013/5/25

Objects

Robert2.0 Robert2.0

2013/5/25

#
How to I get the number of object in a class?
Nike.Sprite Nike.Sprite

2013/5/25

#
public int numberOfObjects() Get the number of actors currently in the world. Returns: The number of actors
danpost danpost

2013/5/25

#
Nike.Sprite wrote...
public int numberOfObjects() Get the number of actors currently in the world. Returns: The number of actors
This will not get the number of actors in a class, only the number of ALL actors in the world. To get the number of objects in a class, you would use:
int actorCount = getObjects(ActorClassname.class).size();
Robert2.0 Robert2.0

2013/5/25

#
Thank you I figured it out
Nike.Sprite Nike.Sprite

2013/5/25

#
Oh yes indeed I'm sorry danpost
You need to login to post a reply.