Easy question on how best to track actor count...
gamesfua
Member Posts: 723
Hey all, i've got a pretty easy question for you (i think).
I need to accurately keep track of how many of my actors are on screen, because when they're all gone (hit zero) a new wave of actors need to spawn. I've been able to achieve this by having an attribute that is updated with a +1 everytime an actor spawns. So when the attribute hits zero it then sends the new wave out. However, while this works 99% of the time, i've noticed sometimes it doesn't.
Is there any better way of doing this that can guarantee stronger and more reliable results? Thanks!
I need to accurately keep track of how many of my actors are on screen, because when they're all gone (hit zero) a new wave of actors need to spawn. I've been able to achieve this by having an attribute that is updated with a +1 everytime an actor spawns. So when the attribute hits zero it then sends the new wave out. However, while this works 99% of the time, i've noticed sometimes it doesn't.
Is there any better way of doing this that can guarantee stronger and more reliable results? Thanks!
Comments
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Meaning lets say your actor is spawned and then it overlaps something that destroys it- that the object destroyer should have the change attribute versus the spawned actor changing the attribute?
So thanks! Definitely going to check that out. I'm sure you're right. Thanks again everyone!
Spawner actor
Spawn actor [actor name]
Spawned actor:
Change Attribute game.actorCount to game.actorCount+1
When [condition for destroying the actor]
.....Change Attribute game.actorCount to game.actorCount-1
.....Destroy Actor
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User