How To Make an Animated Health Bar

tgbtom

  • Posts: 127
Ever wondered how you could make a health bar that smoothly lowers when you lose health, rather than just jumped down? Well after some consideration i discovered a creative way of pulling this off. In fact it's quiete easy to do even in design mode.

It requires you to create 3 Number attributes:
-Health (Current health)
-MaxHealth (Maximum Health)
-DamageTaken [Temporary amount of damage taken(reduces and increases as follows)]

To make the player take damage, inside the parameters make sure you just make it increase DamageTaken by the amount of health you want taken off.

Edit***
It's also pretty easy to add a maximum size to the health bar just by limiting the health to the max health and implementing the max health into the width of the bar using something like:
health / max health X 200  <-- This would set the max width to 200 pixels
/ = division

-Tgbtom

« Last Edit: October 10, 2012, 07:34:42 pm by tgbtom »
________________,.-*'Renewal'*-.,________________
http://community.stencyl.com/index.php/topic,10615.0.html

http://renewalthegame.blogspot.ca/
------------------------'*-.,Renewal,.-*'------------------------

skyepilot2

  • Posts: 24
this works like a charm!!! great addition to a game.  We would just like to see that it may have helped someone? if not then it may be a "renewal exclusive technique" (probably not, it just sounds cool)
Renewal Beta!!!!!!  test it out and give us some comments :D
http://community.stencyl.com/index.php/topic,10615.0.html

punkineo

  • Posts: 13
Thanks, I thought this was really useful. I modified this a bit and stuck it on the end of Crash Course 2.

tgbtom

  • Posts: 127
Awesome, Im glad somebody was able to get use out of it :) And of course, I just threw together a basic outline of it so you could understand the mechanics of it.
________________,.-*'Renewal'*-.,________________
http://community.stencyl.com/index.php/topic,10615.0.html

http://renewalthegame.blogspot.ca/
------------------------'*-.,Renewal,.-*'------------------------

martigas

  • Posts: 15
Hey man, great thing you go tthere..  do you mind uploading it to stencylforge? since im really noob when it comes to programming :/

thanks alot loved it

Mathias

tgbtom

  • Posts: 127
No I do not mind. It wont be a problem. I will try my best to upload it tomorrow after school if I can get on my other computer and if I remember. Exams are starting on wednsday and I have a ton of studying to do so I'll try my best to remember, and if I don't post on here again within 48 hours, contact me via this thread, because it will email me when there is a reply and I check my email at night on my netbook.

Anyways, getting late, good night, I hope to be of more service.


« Last Edit: October 07, 2012, 06:40:37 am by tgbtom »
________________,.-*'Renewal'*-.,________________
http://community.stencyl.com/index.php/topic,10615.0.html

http://renewalthegame.blogspot.ca/
------------------------'*-.,Renewal,.-*'------------------------

Valeriana

  • Posts: 7
great work what i really need tgbtom! keep the good work! 8)

tgbtom

  • Posts: 127
Thanks, glad it could help. If you need help with any other things feel free to inbox me and we'll see what I can do. Check out Renewal (In my signature) and theres plenty of cool features on that I could show you:

-Cutting down trees
-Time system : Darkening the entire scene with minimal lag during late/early hours


-Tgbtom :)
________________,.-*'Renewal'*-.,________________
http://community.stencyl.com/index.php/topic,10615.0.html

http://renewalthegame.blogspot.ca/
------------------------'*-.,Renewal,.-*'------------------------

ridhwaan08

  • Posts: 288
Very good,you are a really good programmer , I like the recipe system in your game and also the fight system anyways good luck with your game and I hope it does well

PS:I would like to know how you did a few things in your game
Nothing is impossible, the word itself says 'I'm possible'!

Audrey Hepburn

tgbtom

  • Posts: 127
Thanks a bunch :)

What systems/things would you like to know about from within the game? I would be willing to share how most of it is done, but you'll have to be fairly specific because the game itself has around 50 scene behaviours, and 13 actor behaviours. :P

You can message me or just post it here. Either way i'm most likely going to make a new thread to explain the process or just PM you what was done :)

Best regards.
________________,.-*'Renewal'*-.,________________
http://community.stencyl.com/index.php/topic,10615.0.html

http://renewalthegame.blogspot.ca/
------------------------'*-.,Renewal,.-*'------------------------

ridhwaan08

  • Posts: 288
@tgbtom

Thanks a lot great help :)
Nothing is impossible, the word itself says 'I'm possible'!

Audrey Hepburn

jenyafio100

  • Posts: 35
please move it to ask a question.

tgbtom

  • Posts: 127
please move it to ask a question.

...This is a resource, not a question?
________________,.-*'Renewal'*-.,________________
http://community.stencyl.com/index.php/topic,10615.0.html

http://renewalthegame.blogspot.ca/
------------------------'*-.,Renewal,.-*'------------------------


Greymtr

  • Posts: 34
This is just so AWESOME!!
I've decided to feed this to the programmers helping me!!

AWESOME!!
Part time gamer.Part time n00b. Full time Sci-fi Fan.