Discuss Scratch

drywaIl
Scratcher
7 posts

Clones

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?
deck26
Scratcher
1000+ posts

Clones

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
Scratcher
7 posts

Clones

Bet, sending now.
deck26
Scratcher
1000+ posts

Clones

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..
goosewithnoeggs
Scratcher
25 posts

Clones

when I start as a clone
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
Clone ID has to be set to for this sprite only.
Set the variables to 0 at the beginning and delete all of the list.

if <[Making A Dumb Mistake] = [True]> then
set [Emotion] to [Confused]
ask [Please Correct Me] and wait
else
set [Emotion] to [Happy]
end
Check out my stuff I do math stuff and simple animations - Goose
I guess I'm here too - Audrey

.
deck26
Scratcher
1000+ posts

Clones

goosewithnoeggs wrote:

when I start as a clone
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
Clone ID has to be set to for this sprite only.
Set the variables to 0 at the beginning and delete all of the list.
No need for a list, the zombies already have a local variable.
drywaIl
Scratcher
7 posts

Clones

ty

Powered by DjangoBB