Discuss Scratch

Mk123233
New Scratcher
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?
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
playerhealth

And do this script:
whenclickedforevergotox:playerxy:playery+howfarabovetheplayeryouwantthehealthbartobeswitchcostumetoplayerhealthifhealth=0thendeathscript
TheLogFather
Scratcher
1000+ posts

How to do HP bar?

Mk123233
New Scratcher
12 posts

How to do HP bar?

Thanks guys!
fred12312
Scratcher
1 post

How to do HP bar?

Its not working.
:(Your text to link here…
whenclickedif= = thensetto setto setto setto setto setto setto
JavierR100
Scratcher
500+ posts

How to do HP bar?

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.

whenclickedforeverif(hp)>(hpMax)thensethptohpMaxif(hp)<0thensethpto0drawBardrawProgress

definedrawBarpenupgotox:-193y:-170setpensizeto12setpencolortopendownchangexby170penup

definedrawProgressdrawBarpenupgotox:-193y:-170setpensizeto7setpencolortopendownchangexbyhp*170/hpMax
maverick_raven12
Scratcher
100+ posts

How to do HP bar?

try making a costume for each amount of HP then use this script:
whenclickedforeverswitchcostumetoHPifHP=0 thendie

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
deck26
Scratcher
1000+ posts

How to do HP bar?

Kahngw25 wrote:

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
Please create your own new topic rather than necroposting. In what way would a health bar use a username?
Dragoion
Scratcher
76 posts

How to do HP bar?

Just make a varible named hp for this sprite only
Dragoion
Scratcher
76 posts

How to do HP bar?

TheHockeyist wrote:

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
playerhealth

And do this script:
whenclickedforevergotox:playerxy:playery+howfarabovetheplayeryouwantthehealthbartobeswitchcostumetoplayerhealthifhealth=0thendeathscript
Yep that is one way
StrangeMagic32
Scratcher
1000+ posts

How to do HP bar?

Dragoion wrote:

Just make a varible named hp for this sprite only

Dragoion wrote:

TheHockeyist wrote:

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
playerhealth

And do this script:
whenclickedforevergotox:playerxy:playery+howfarabovetheplayeryouwantthehealthbartobeswitchcostumetoplayerhealthifhealth=0thendeathscript
Yep that is one way
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 necropost
AP56RM09
New Scratcher
1 post

How to do HP bar?

?
Kraken_Games
Scratcher
100+ posts

How to do HP bar?

AP56RM09 wrote:

?
please don't necropost

Powered by DjangoBB