Clones
id: 749464
category: Help with Scripts
posts: 8
drywaIl
loading
I'm making a game where you play as a turret and fight zombies with bullets, but I want each zombie to die invidually.
But all the zombies die at once when one gets hit.
Does anyone know how to fix it?
But all the zombies die at once when one gets hit.
Does anyone know how to fix it?
deck26
loading
Do they have separate health values? Are you using a broadcast to kill them? Sharing the project and telling us how to replicate the issue makes it far easier to help.
drywaIl
loading
Bet, sending now.
deck26
loading
The zombies need to detect touching the bullet, you can't just broadcast when the bullet detects the touch. All the zombies get the broadcast and change their own helath value.
So the bullet detects the touch and waits 0 secs to give the zombie time to react and then deletes itself. Similarly the zombie detects teh buttle and changes its health value and waits 0 seconds before checking to see if it is dead..
So the bullet detects the touch and waits 0 secs to give the zombie time to react and then deletes itself. Similarly the zombie detects teh buttle and changes its health value and waits 0 seconds before checking to see if it is dead..
goosewithnoeggs
loading
when I start as a cloneClone ID has to be set to for this sprite only.
change [Clones] by (1)
set [Clone ID] to (Clones)
add [Max HP] to [Zombie HP v]
repeat until <(item (Clone ID) of [Zombie HP v] :: list) < [1]>
Zombie Ai
if <touching [Bullet v] ?> then
replace item (Clone ID) of [Zombie HP v] with ((item (Clone ID) of [Zombie HP v] :: list) - (1))
end
end
Set the variables to 0 at the beginning and delete all of the list.
deck26
loading
No need for a list, the zombies already have a local variable.when I start as a cloneClone ID has to be set to for this sprite only.
change [Clones] by (1)
set [Clone ID] to (Clones)
add [Max HP] to [Zombie HP v]
repeat until <(item (Clone ID) of [Zombie HP v] :: list) < [1]>
Zombie Ai
if <touching [Bullet v] ?> then
replace item (Clone ID) of [Zombie HP v] with ((item (Clone ID) of [Zombie HP v] :: list) - (1))
end
end
Set the variables to 0 at the beginning and delete all of the list.