Discuss Scratch

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

how do make a sprite die when its hp reahes zero(0)

can I see a project
cooldudue
Scratcher
38 posts

how do make a sprite die when its hp reahes zero(0)

gtman
Scratcher
24 posts

how do make a sprite die when its hp reahes zero(0)

thanks
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)

cooldudue wrote:

must this be in the attacker or the sprite gettin destroyed

The 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)

silverknight108 wrote:

oh really *cracks knuckles* well its easy

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]
Fixed formatting / code flow. Also this looks a lot like my previous script (minus the touching):

MegaApuTurkUltra wrote:

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)
Try not to post dups.
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)

Domestic-_-Melon wrote:

It worked for me
confused man
Please don't necropost. This topic is pretty old. Please check the date of the post before posting. Thanks.

Powered by DjangoBB