Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » how do make a sprite die when its hp reahes zero(0)
- cooldudue
-
Scratcher
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
-
Scratcher
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
-
Scratcher
38 posts
how do make a sprite die when its hp reahes zero(0)
its in by the walls
- MegaApuTurkUltra
-
Scratcher
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
-
Scratcher
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
-
Scratcher
1000+ posts
how do make a sprite die when its hp reahes zero(0)
must this be in the attacker or the sprite gettin destroyedThe sprite getting destroyed. Make some sort of broadcast system for the attacker to send damage to the sprite being destroyed.
- mastermind1201
-
Scratcher
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
-
Scratcher
38 posts
how do make a sprite die when its hp reahes zero(0)
for some reason none of this is woking
- silverknight108
-
Scratcher
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
-
Scratcher
1000+ posts
how do make a sprite die when its hp reahes zero(0)
oh really *cracks knuckles* well its easyFixed formatting / code flow. Also this looks a lot like my previous script (minus the touching):when 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]
TryTry not to post dups.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)
- Domestic-_-Melon
-
Scratcher
67 posts
how do make a sprite die when its hp reahes zero(0)
It worked for me

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







