Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » making health go down
- Eluswag
- New to Scratch
9 posts
making health go down
how do u make a person health go down when he touches something.
- Randomslime
- Scratcher
68 posts
making health go down
when green flag clicked
set [Health v] to (Whatever You Want)
forever
if <touching (Whatever You Want)?> then
change [Health v] by (-1)
broadcast [Delete Whatever Touched It Or Restart v]
end
end
My signature is missing. Kidnapped, probably. I really don't know. I haven't received a ransom demand yet, so I'm not sure if it was kidnapped or not. It might just be on vacation, like I said, I don't know. In fact, I don't even bother to look for my signature, so it could be beneath this for all I know. But it's not. At least, I don't think it is.
- Tomerts
- Scratcher
47 posts
making health go down
Here.
Make the variable Health switch costumes of a sprite called Health. When the Health var becomes 1 make the costume be 1 heart.
Anyway, make an “if touching (Whatever you want)”
Under that put “change Health by -1”
That will make it so everything it touches the specific thing, it will lose 1 health.
You can change any part of this if needed.
If you are having trouble, tell me and I will create an example game for you.
Make the variable Health switch costumes of a sprite called Health. When the Health var becomes 1 make the costume be 1 heart.
Anyway, make an “if touching (Whatever you want)”
Under that put “change Health by -1”
That will make it so everything it touches the specific thing, it will lose 1 health.
You can change any part of this if needed.
If you are having trouble, tell me and I will create an example game for you.
- Sonickyle
- Scratcher
1000+ posts
making health go down
when green flag clicked
set [health v] to [100]
forever
wait until <touching [enemy v]?>
change [health v] by (-1)
broadcast [enemy kill v]
end
This is more efficiant, as it doesn't constantly loop. It'll do the exact same thing as the example Randomslime made.
No I don't make projects anymore. I left some time ago.
I only check the forums every now and then, but other than that consider me retired.
I only check the forums every now and then, but other than that consider me retired.
- Warriorpelt343
- Scratcher
3 posts
making health go down
um but when it goes farther down then when i need it it keeps going how does that stop at 100? >
this is how i did it
this is how i did it
when green flag clickedand it did not work it is past 5000 by now PLZ HELP
set [[scratchblocks]
v] to [0][/scratchblocks]
forever
[scratchblocks]
<touching [ v]?>
change [ v] by (1)
broadcast [ v]
endend
[/scratchblocks]
- Sonickyle
- Scratcher
1000+ posts
making health go down
If you mean you don't want it to go above 100, then:
This will make it so if the health goes above 100, it will stay at 100.
when green flag clicked
forever
wait until <(health) > [100]>
set [health v] to [100]
end
This will make it so if the health goes above 100, it will stay at 100.
Last edited by Sonickyle (Feb. 12, 2014 13:21:38)
No I don't make projects anymore. I left some time ago.
I only check the forums every now and then, but other than that consider me retired.
I only check the forums every now and then, but other than that consider me retired.
- Warriorpelt343
- Scratcher
3 posts
making health go down
and i wanna make health stop at 0 plz help me this game is becoming good thanks for information
- Sonickyle
- Scratcher
1000+ posts
making health go down
and i wanna make health stop at 0 plz help me this game is becoming good thanks for information
when green flag clicked
forever
wait until <(health) < [0]>
set [health v] to [0]
...
end
Last edited by Sonickyle (Feb. 12, 2014 18:02:55)
No I don't make projects anymore. I left some time ago.
I only check the forums every now and then, but other than that consider me retired.
I only check the forums every now and then, but other than that consider me retired.
- MasterCard786
- Scratcher
100+ posts
making health go down
when green flag clicked
set [HP] to [10]
forever
if <touching color [#f0f]?> then
change [HP] by (-1)
end
end
if <(HP) = [0]> then
DIE
end
Check these: APEX NEWS ISSUE 2 - http://scratch.mit.edu/projects/20648596/
And the amazing square - http://scratch.mit.edu/projects/20741133/
- alinktokreep
- Scratcher
1 post
making health go down
What if you wanted the backdrop to change when something reaches a certain amount of health
- EliteProgramming
- Scratcher
100+ posts
making health go down
What if you wanted the backdrop to change when something reaches a certain amount of health
when green flag clicked
wait until <[Health] < [50]>
switch backdrop to [Something v]
Providing Platinum Quality Memes™
- sowmiyan123
- Scratcher
14 posts
making health go down
when green flag clicked
if <(health) = [ 0]> then
change [ v] by (-1)
stop [ v]
end
(Sowmiyan)
say [Sowmiyan:D]
- sowmiyan123
- Scratcher
14 posts
making health go down
use these blocks(make your own block
define health
change [ vhealth by (-1)
(Sowmiyan)
say [Sowmiyan:D]
- adynlavine
- Scratcher
39 posts
making health go down
when green flag clicked
forever
if <touching [ the sprite] ?> then
change [ health] by (-1)
end
wait until <not <touching [the sprite] ?>>
end
- JavierR100
- Scratcher
500+ posts
making health go down
um but when it goes farther down then when i need it it keeps going how does that stop at 100? >ᵍᵒᵒᵈ ᶜᵒᵈᶦᶰᵍ ᵗʰᵉʳᵉ
this is how i did itwhen green flag clickedand it did not work it is past 5000 by now PLZ HELP
set [ v] to [0]
if <touching [ v]?>
change [ v] by (1)
broadcast [ v]
end
use this:
when green flag clicked
forever
if <touching [enemy v] ?>
change [HP v] by (-1)
. . .
wait ( . . . ) secs
. . .
end
My customs Blocks on “Snap!” || search in google HN54FyF4KW27o*YWAD94qjEMLV62+]59 to find all my posts. || “Fantasy Tank Builder” Topic || Diep.io | Official Thread || Geometry Dash name account: "JavierR100". || Geometry Dash Official Topic
Actually, [B]en is my legal name!- Pen, BFB 5
Sorry, I'm gone to roblox now, so Im not able to reply anymore!
Sorry, I'm gone to roblox now, so Im not able to reply anymore!
- mrlm1105
- Scratcher
17 posts
making health go down
What if you wanted the backdrop to change when something reaches a certain amount of healthwhen green flag clicked
wait until <[Health] < [50]>
switch backdrop to [Something v]
You forgot the forever block!
when gf clicked
forever
wait until <[Health] < [50]>
switch backdrop to [Something v]
end
(9) + (10) = (19) :: operators hat
- Discussion Forums
- » Help with Scripts
- » making health go down