PDA

View Full Version : Health Bars!

zero00
06-07-2011, 02:07 AM
Update: The finished health bars are on post #15 :D
Feel free to read this, though :D

This was an experiment that had defeated me every time I tried it...but now...

I have figured out how to get health bars to work in Alice worlds (for the most part)!

I don't mean the kind of "health bars" made of a bunch of individual squares or what-have-you. I mean the 2D kind, similar to ones you would see in games like Street Fighter and the like.

I haven't fully figured out the secret to this, but progress is being made very quickly!

Here are my experiments. Feel free to learn from them or use them however you want.

"true_healthbar_exper.a2w" was my latest experiment that I used to figure this out! It's also kind of broken and slightly confusing, but it has some of basic functions for the healthbars to work. "HUD_experiments.a2w" uses healthbars in a game-like environment!

David B
06-07-2011, 06:51 AM
Cool! Nice job! These would make great examples for someone who needs help with healthbars!

zero00
06-07-2011, 08:15 AM
Thanks!
BTW, the math for getting these things to work is really confusing. :P

David B
06-07-2011, 01:41 PM
Thanks!
BTW, the math for getting these things to work is really confusing. :P

I agree! My health bars never turn out that good!

Click here (http://www.alice.org/community/attachment.php?attachmentid=4423&d=1301406763) to download my health bar.

zero00
06-07-2011, 03:50 PM
Update:
The health bars are coming along nicely, though they are still confusing...

This is Experiment 2. Shoot the sphere (with the space bar) and the bar decreases accordingly. Press Enter to restore the sphere's health.

There's still a few things to figure out like what the bar will do when the enemy's health is fully depleted...

David B
06-07-2011, 04:12 PM
Update:
The health bars are coming along nicely, though they are still confusing...

This is Experiment 2. Shoot the sphere (with the space bar) and the bar decreases accordingly. Press Enter to restore the sphere's health.

There's still a few things to figure out like what the bar will do when the enemy's health is fully depleted...

This one is even better than the first one! Nice job!

jediaction
06-07-2011, 04:41 PM
I thought about making a health bar like this, but was always to lazy to do it. Cool! Now I see what it looks like!

zero00
06-07-2011, 09:46 PM
I think I've found the formula to resize the health bars!
It works much more reliably now!
Still need to figure what to do when it hits zero...:p

Here's the results:

zero00
06-07-2011, 10:12 PM
I think the Health bar is pretty much done now! :D :D

====Changes===================
You can now heal by any amount now!
Damage can go below zero, like "-8", but only once
=============================

Here is the pretty-much finished healthbar!
I'll work on a more easy-to-use version, soon. :D

Mr Kidnapper
06-07-2011, 10:20 PM
I always thought to abuse transparency glitches to make partial objects, at least from the view of the camera. But then until today I didn't know there was a resize variable to change an object height or width-wise. Found out from that one recoil world. :| How annoying.
How about a separate event that detects if it is less than 0, and sets it to 0?
But what I don't understand is what's wrong if it goes negative. Why is it bad? I let it damage deep into the negatives with multiple hits and nothing bad particularly happens.
Ha. Now all people need to do is design armor points and how it will affect damage.

zero00
06-07-2011, 11:23 PM
I don't think I added anything to the "decrease health" method to set it to zero if it went negative.
Somehow I never got around to doing that... :p Thanks!

zero00
06-07-2011, 11:57 PM
The healthbar project has been completed! :D
(Updated versions are possible, though)

and...

Now, a portable version has also been created! :D:D
This means you too can have your own healthbars in your Alice Worlds!
AND...you can use whatever kind of healthbar you want! (probably)

Download the "Healthbar_controler_v3.a2c" object and simply place it in your world!
(it's not that simple, though ;))

Look at the included world for a demonstration!

To make the Healthbar controllers work in your Alice worlds:
please look at the readme!

Mr Kidnapper
06-08-2011, 02:33 AM
Not quite complete. Once the health bar reaches zero, it no longer grows back. This is likely because you're not about to multiply the size of 0 back to 100%, it would be the same as dividing by zero. I suggest to you that you place a "Landmark" health number, in which the width, or whatever dimension of the health bar is saved so that when the health bar has reached the irreversible zero, it can revert back to said dimension. Perhaps .001, or outright 100%?

zero00
06-08-2011, 02:59 AM
Good point. Thanks, I'll try to fix this. :D
(I thought about trying to shrink it by 0.001 or something when it reached zero, but I didn't want to that, so I made it invisible instead! (I think))

Aside from that, did the health bar work for you? :D

zero00
06-08-2011, 03:50 AM
The code for this things is getting more complicated...but I fixed it!

===Change============
-You increase the health when its at zero
====================

It works by resetting the object's health back to its original state and then subtracting a huge amount from it, so it seems like its been healed :rolleyes:

A bit crude, but it works I guess...

Here's the fixed version:
There's also a demo showing the new healthbar controller!

The readme from post #12 still applies!