I know you can type how many entities are in the world with
FP.world.typeCount(“nameHere”)
but what about names?
I know you can type how many entities are in the world with
FP.world.typeCount(“nameHere”)
but what about names?
I think he’s referring to the name
property on entities.
Do you mean how can you find out how many entities have the same name? The answer is only ever one at most. If more than one entity has the same name, the most-recently added one will be found with getInstance()
.
There isn’t a way to get a list of all the names in current use, as far as I know.
Yes, I meant the name property.
I want to have an enemy which spawns offspring only if the amount of offspring currently in the world is less than 5 the enemies must have the “enemy” type to work in my game (long story)
any advice on a solution?
After creating the offspring, you could store a reference to the offspring in some sort of collection (a Vector.<Offspring>
or a linked list). Then, whenever you want to spawn a new offspring, check your list. If any offspring are dead or no longer exist, remove them from your list. If the final size of the list is less than five, proceed with spawning.