Discuss Scratch

NitoReagan
Scratcher
61 posts

why are some of my enemies invincible

I don't see anything wrong with my code but for some reason some of the enemy clones that spawn either have a boat load of health or just don't take damage

https://scratch.mit.edu/projects/851344592
rodper6635
Scratcher
100+ posts

why are some of my enemies invincible

It's that the enemies' health goes under 0 if the bullet hits them before exploding, and they only delete if their health is exactly 0. Edit the “delete” script like this script;
when I start as a clone
set [Health v] to [0]
show
forever
if <(Health) < [0]> then
change [Score v] by [1]
delete this clone
end
end
You might also want to slow down the bullet because it's going so fast it doesn't collide.

Last edited by rodper6635 (May 16, 2023 15:04:55)

NitoReagan
Scratcher
61 posts

why are some of my enemies invincible

rodper6635 wrote:

It's that the enemies' health goes under 0 if the bullet hits them before exploding, and they only delete if their health is exactly 0. Edit the “delete” script like this script;
when I start as a clone
set [Health v] to [0]
show
forever
if <(Health) < [0]> then
change [Score v] by [1]
delete this clone
end
end
You might also want to slow down the bullet because it's going so fast it doesn't collide.
TYSM!
rodper6635
Scratcher
100+ posts

why are some of my enemies invincible

No problem!

Powered by DjangoBB