Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » how do make a sprite die when its hp reahes zero(0)
- cooldudue
-
38 posts
how do make a sprite die when its hp reahes zero(0)
whenever one of my sprites hp reaches zero it does not die pls help
- ChaoticParadise
-
46 posts
how do make a sprite die when its hp reahes zero(0)
I don't see the hp script, is it actually in there or are you generally asking how to do it?
- cooldudue
-
38 posts
how do make a sprite die when its hp reahes zero(0)
its in by the walls
- MegaApuTurkUltra
-
1000+ posts
how do make a sprite die when its hp reahes zero(0)
Try
Define reduce health by (amount)
change [health v] by ((0)-(amount))
if<not<(health)>(0)>> // if health is not greater than 0, then
hide
stop [other scripts in sprite v] // deactivate sprite by hiding and stopping its scripts
end
// to reduce health:
reduce health by (20)
- cooldudue
-
38 posts
how do make a sprite die when its hp reahes zero(0)
must this be in the attacker or the sprite gettin destroyed
- MegaApuTurkUltra
-
1000+ posts
how do make a sprite die when its hp reahes zero(0)
The sprite getting destroyed. Make some sort of broadcast system for the attacker to send damage to the sprite being destroyed. must this be in the attacker or the sprite gettin destroyed
- mastermind1201
-
100+ posts
how do make a sprite die when its hp reahes zero(0)
when green flag clicked
if <(hp) = [0 ]> then
broadcast [Curiosity kills the cat v]
end
when I receive [Curiosity kills the cat v]
switch backdrop to [end v]
stop [all v]
- cooldudue
-
38 posts
how do make a sprite die when its hp reahes zero(0)
for some reason none of this is woking
- silverknight108
-
82 posts
how do make a sprite die when its hp reahes zero(0)
oh really *cracks knuckles* well its easy
if <touching [enemy v] ?> then
change [health v] by (-1)
end
if<(not((health) > 0) :: operator)::operator ?) then
hide
stop[all script in this sprite v]
end
- MegaApuTurkUltra
-
1000+ posts
how do make a sprite die when its hp reahes zero(0)
Fixed formatting / code flow. Also this looks a lot like my previous script (minus the touching): oh really *cracks knuckles* well its easywhen gf clicked
forever
if <touching [enemy v] ?> then
change [health v] by (-1)
if<not<(health) > (0)>> then
hide
stop[all scripts in this sprite v]
Try not to post dups. TryDefine reduce health by (amount)
change [health v] by ((0)-(amount))
if<not<(health)>(0)>> // if health is not greater than 0, then
hide
stop [other scripts in sprite v] // deactivate sprite by hiding and stopping its scripts
end
// to reduce health:
reduce health by (20)
- Domestic-_-Melon
-
67 posts
how do make a sprite die when its hp reahes zero(0)
It worked for me

confused man
- DrKat123
-
1000+ posts
how do make a sprite die when its hp reahes zero(0)
Please don't necropost. This topic is pretty old. Please check the date of the post before posting. Thanks. It worked for meconfused man
- Discussion Forums
- » Help with Scripts
-
» how do make a sprite die when its hp reahes zero(0)