Discuss Scratch

Underseeker5
Scratcher
33 posts

how do you make a healthbar?

I'm currently developing a fps project where you are manning a cannon in a pirate ship and are shooting at a Giant Squid.

obviously, health is controlled via variable, but is there a way to make a full-on healthbar for a boss? i've tinkered with this a bit, but never got anything to work (nothing that looked good, at least).

Is there any way to implement a healthbar into a project?

how do i signature
codeman1044
Scratcher
1000+ posts

how do you make a healthbar?

Check this out, though you'll need to mess around with it a bit.

This is my signature, which shows up every time I post and is automatic. To make a signature of your own, locate the “Change your signature” option in the bottom left of the Discussion Home.
I am nothing if not consistently inconsistent.
Snap! is a website that offers block coding like Scratch, but also offers the creation of your own blocks and writing JavaScript functions. The adventurous should consider checking it out!
Potentially useful tutorials and topic coverage
If you want to see a new tutorial added to this, feel free to leave a suggestion on my profile.
iapere02
Scratcher
100+ posts

how do you make a healthbar?

Its that easy, but only if you are talking about an UNDERTALE health bar. (The 92 and -1 is if its done in a sans fight)
when green flag clicked
hide variable [HP v]
set [HP v] to [92]
when I receive [Fight Start v]
show variable [HP v]
when I receive [Hit v]
change [HP v] by (-1)

Or something like Fight Start block.

Last edited by iapere02 (March 4, 2020 02:58:02)


hi
RokCoder
Scratcher
1000+ posts

how do you make a healthbar?

Underseeker5 wrote:

Is there any way to implement a healthbar into a project?
Here's another example - it contains code for both pen and sprite methods.


Scratch dabbling for fun…

iapere02
Scratcher
100+ posts

how do you make a healthbar?

RokCoder wrote:

Underseeker5 wrote:

Is there any way to implement a healthbar into a project?
Here's another example - it contains code for both pen and sprite methods.
Or variables.

hi
RokCoder
Scratcher
1000+ posts

how do you make a healthbar?

iapere02 wrote:

Or variables.
Sorry?


Scratch dabbling for fun…

ReznorZEZ
Scratcher
100+ posts

how do you make a healthbar?

Underseeker5 wrote:

I'm currently developing a fps project where you are manning a cannon in a pirate ship and are shooting at a Giant Squid.

obviously, health is controlled via variable, but is there a way to make a full-on healthbar for a boss? i've tinkered with this a bit, but never got anything to work (nothing that looked good, at least).

Is there any way to implement a healthbar into a project?
Its very simple! what I do is just this:
when green flag clicked
set [health v] to [Anything you want]
if <touching [enemy v] ?> then
change [health v] by ([-Whatever you want])
end
if <[Health v] = [0]> then
broadcast [Die v]
end
Then just make a sprite with hearts or health indicators, then make one disappear when you get hit. When there is 0, you die. Make the ¨die¨ broadcast end the game and take you to the title screen (if there is one).

Last edited by ReznorZEZ (March 10, 2020 18:03:07)


-Reznor
iapere02
Scratcher
100+ posts

how do you make a healthbar?

RokCoder wrote:

iapere02 wrote:

Or variables.
Sorry?
i know this is old but wdym?

hi
FoofJr
Scratcher
100+ posts

how do you make a healthbar?

iapere02 wrote:

RokCoder wrote:

iapere02 wrote:

Or variables.
Sorry?
i know this is old but wdym?
If it is old, don't reply.

Why hello there! Wonder why you are checking out my signature. While you're at it, why not check out my Gradient generator?

Powered by DjangoBB