Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to do HP bar?
- Mk123233
- New to Scratch
12 posts
How to do HP bar?
Hi guys,
So, I wanted to do a little improvment to my game and I thought it would be easier to play when your player has HP.
I think you already know my question so…
How am I adding to my player hp bar?
So, I wanted to do a little improvment to my game and I thought it would be easier to play when your player has HP.
I think you already know my question so…
How am I adding to my player hp bar?
- TheHockeyist
- Scratcher
1000+ posts
How to do HP bar?
The easiest way is a sprite. Make a sprite. On the first costume, write a 1. On the second, 2, etc. until you reach the highest possible health. On the last costume, write a 0.
Make a variable
And do this script:
Make a variable
(player health)
And do this script:
when green flag clicked
forever
go to x: (player x) y: (player y + how far above the player you want the health bar to be)
switch costume to (player health)
if <(health) = [0]> then
death script
end
end
- TheLogFather
- Scratcher
1000+ posts
How to do HP bar?
These projects may help:
- Status/health bar drawn with pen - - Using variables as status/health bar -
- Status/health bar drawn with pen - - Using variables as status/health bar -
Siggy the Kumquat slayer:
Main account: DadOfMrLog –– Frameworks for basic pen-rendered 3D in scratch (see studio). Examples:
- - - - 3D Text - - - - - - Simple shapes - - - Controllable structures - - - On the ground - - - - - - In space - - - -
- - - - 3D Text - - - - - - Simple shapes - - - Controllable structures - - - On the ground - - - - - - In space - - - -
- fred12312
- Scratcher
1 post
How to do HP bar?
Its not working.
:(Your text to link here…
:(Your text to link here…
when green flag clicked
if << = [ ]> = [ ]> then
set [ v] to [ ]
set [ v] to [ ]
set [ v] to [ ]
set [ v] to [ ]
set [ v] to [ ]
set [ v] to [ ]
set [ v] to [ ]
end
- JavierR100
- Scratcher
500+ posts
How to do HP bar?
this might work:
https://scratch.mit.edu/projects/107933026/
https://scratch.mit.edu/projects/107933026/
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!
- Jemmerl
- Scratcher
100+ posts
How to do HP bar?
The way I do it is with a sprite and pen. Just edit color, pen size, and positions to get the desired bar.
when green flag clicked
forever
if <[(hp)] > [(hpMax)]> then
set [hp v] to [hpMax]
end
if <[(hp)] < [0]> then
set [hp v] to [0]
end
drawBar
drawProgress
end
define drawBar
pen up
go to x: (-193) y: (-170)
set pen size to (12)
set pen color to [#ff0088]
pen down
change x by (170)
pen up
define drawProgress
drawBar
pen up
go to x: (-193) y: (-170)
set pen size to (7)
set pen color to [#fa0111]
pen down
change x by (((hp) * (170)) / (hpMax))
Always use message1. The gods of Scratch gave it to you for a reason.
- maverick_raven12
- Scratcher
100+ posts
How to do HP bar?
try making a costume for each amount of HP then use this script:
when green flag clicked
forever
switch costume to (HP)
if <(HP) = [0 ]> then
die
end
end
Last edited by maverick_raven12 (May 4, 2016 23:45:17)
- Kahngw25
- Scratcher
7 posts
How to do HP bar?
I know how to make a health bar, but would anybody know how to make a health bat that uses a player's username?
EX: Kahngw25's HP
EX: Kahngw25's HP
It is not what someone is born, rather what they grow to be!
- deck26
- Scratcher
1000+ posts
How to do HP bar?
Please create your own new topic rather than necroposting. In what way would a health bar use a username? I know how to make a health bar, but would anybody know how to make a health bat that uses a player's username?
EX: Kahngw25's HP
- Dragoion
- Scratcher
76 posts
How to do HP bar?
Yep that is one way The easiest way is a sprite. Make a sprite. On the first costume, write a 1. On the second, 2, etc. until you reach the highest possible health. On the last costume, write a 0.
Make a variable(player health)
And do this script:when green flag clicked
forever
go to x: (player x) y: (player y + how far above the player you want the health bar to be)
switch costume to (player health)
if <(health) = [0]> then
death script
end
end
- StrangeMagic32
- Scratcher
1000+ posts
How to do HP bar?
Just make a varible named hp for this sprite only
It's nice that you want to help, but this post is from 2016, so I believe that they figured it out… So please don't necropostYep that is one way The easiest way is a sprite. Make a sprite. On the first costume, write a 1. On the second, 2, etc. until you reach the highest possible health. On the last costume, write a 0.
Make a variable(player health)
And do this script:when green flag clicked
forever
go to x: (player x) y: (player y + how far above the player you want the health bar to be)
switch costume to (player health)
if <(health) = [0]> then
death script
end
end
“Remember the worth of souls is great in the sight of God;”
- Doctrine and Covenants 18:10
I have since moved to @JollyWinter
- Kraken_Games
- Scratcher
100+ posts
How to do HP bar?
please don't necropost ?
KRAKEN_GAMES
I live in the depths
.)
- Discussion Forums
- » Help with Scripts
- » How to do HP bar?