Discuss Scratch

undertale_fan42069
Scratcher
11 posts

How to make your sprite die when hp reaches 0

Hello! Im making an undertale fight and i need to know how to make the soul die when the hp reaches 0
PolySquare
Scratcher
56 posts

How to make your sprite die when hp reaches 0

So, I hope you have made a hp variable. If you have made, then death means to hide. So, you can use the following blocks to show the death of the sprite:
when green flag clicked
forever
if <(hp) = [0]> then
broadcast [death v]
end
end
Then, add the following blocks in the sprite to be dead:
when I receive [death v]
hide
Nezon
Scratcher
1000+ posts

How to make your sprite die when hp reaches 0

PolySquare wrote:

So, I hope you have made a hp variable. If you have made, then death means to hide. So, you can use the following blocks to show the death of the sprite:
when green flag clicked
forever
if <(hp) = [0]> then
broadcast [death v]
end
end
Then, add the following blocks in the sprite to be dead:
when I receive [death v]
hide
First, add a stop this block or it will forever broadcast death, and add a <(hp) < > because hp may go padt 0 like -1 to -10
PolySquare
Scratcher
56 posts

How to make your sprite die when hp reaches 0

Nezon wrote:

PolySquare wrote:

So, I hope you have made a hp variable. If you have made, then death means to hide. So, you can use the following blocks to show the death of the sprite:
when green flag clicked
forever
if <(hp) = [0]> then
broadcast [death v]
end
end
Then, add the following blocks in the sprite to be dead:
when I receive [death v]
hide
First, add a stop this block or it will forever broadcast death, and add a <(hp) < > because hp may go padt 0 like -1 to -10
ook
undertale_fan42069
Scratcher
11 posts

How to make your sprite die when hp reaches 0

it didnt work for me
SaltyTree
Scratcher
100+ posts

How to make your sprite die when hp reaches 0

when green flag clicked
forever
if <(hp) < [1]> then
...
end
end
PolySquare
Scratcher
56 posts

How to make your sprite die when hp reaches 0

This will work wrote:

when green flag clicked
forever
if <(hp) < [1]> then
hide
end
end
Ankit_Anmol
Scratcher
500+ posts

How to make your sprite die when hp reaches 0

SaltyTree wrote:

when green flag clicked
forever
if <(hp) < [1]> then
Die :: grey
end
end
this is correc5
undertale_fan42069
Scratcher
11 posts

How to make your sprite die when hp reaches 0

could you provide a game where this worked?
randomguy3513
Scratcher
1000+ posts

How to make your sprite die when hp reaches 0

heres a better workaround

PolySquare wrote:

So, I hope you have made a hp variable. If you have made, then death means to hide. So, you can use the following blocks to show the death of the sprite:
when green flag clicked
forever
if <(hp) = [0]> then
broadcast [death v]
end
end
Then, add the following blocks in the sprite to be dead:
when I receive [death v]
hide
this is a much better one

if your using costumes numbers to track your health then use this script
when I receive [damage v]
next costume
if <(costume [number v] :: looks) = (10)> then
broadcast [gameover v]
end
if your using a varibles to track your health then use this
when I receive [damage v]
change [health v] by (-1)
if <(health) = (0)> then
broadcast [gameover v]
end

Powered by DjangoBB