how do i have many actors on the same screen using the same (health) attribute,dut die independently
iZeeBo
Member Posts: 8
hi i am making a game where there are many soldiers but then when they are in battle and one soldier dies, all of them die. I know why, it is because they are linked to the same attribute but if you have 500 soldiers on the same scene you are not going to make 500 attributes for all of them, and of course they are all cloned actors that are spawned randomly by a spawn-er.
thanks in advance
thanks in advance
Comments
here are my rules that i have added, just to see if im wrong.
Actor recieves event/overlaps or collides/with actor of type/rest enemy (the test enemy that i have)
then in that rule i have:
change attribute: self.health/To: self.health-1
then in order to kill the soldier i have a new rule with
Attribute/ self.health/(>_)/0.0
and then a destroy behavior.
hope this helps a little
Attribute/ self.health/(>_)/0.0
and then a destroy behavior.
Wouldn't this instantly destroy all of them?
Looking at your example (except for the greater than bit) it looks like it should act correctly which is why I think something else is creating the problem you're experiencing.
Unless of course you used replicate to create the hundreds of enemies, and if so I think that's your problem right there
You would need to have change attribute self.health to 10 (or whatever value) at the top of the rule list. Or you can manually set it in the actor's attribute pane.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Every 0.5 seconds a pink/salmon enemy is spawned on the screen randomly and each shows it's health value. Tap the enemy to deduct 1 health point until it gets down to 0 which destroys it. It destroys that actor only, not all of them