Be a Supporter!

Health Bar & Input Text

  • 361 Views
  • 2 Replies
New Topic Respond to this Topic
Kael-Sorrow
Kael-Sorrow
  • Member since: Sep. 26, 2004
  • Offline.
Forum Stats
Member
Level 19
Blank Slate
Health Bar & Input Text 2012-02-24 22:54:20 Reply

Okay, so I usually use Flash for helping me with some tabletop RPG sessions. I know the veeery basics of AS2 and have no idea how to use any AS3 features...

I've searched Google and Flash forums for hours without any result.
Basically, I have two input text boxes, one representing the full HP, the other representing the current HP. However, I've always wanted to make the grid a little more interesting by adding a health bar, using the 100-frame structure, so I can use different colours as the bar gets closer to 0.
And I can't (for the life of me) make the bar go up or down according to the values I type the text boxes.

Anyone...?
(sorry in advance, English is not my main language, but I read better than I write)


I really lack the ability for signatures. So stop reading this! >_>

Sam
Sam
  • Member since: Oct. 1, 2005
  • Offline.
Forum Stats
Moderator
Level 19
Programmer
Response to Health Bar & Input Text 2012-02-25 05:27:10 Reply

At 6 hours ago, Kael-Sorrow wrote: Okay, so I usually use Flash for helping me with some tabletop RPG sessions. I know the veeery basics of AS2 and have no idea how to use any AS3 features...

I've searched Google and Flash forums for hours without any result.
Basically, I have two input text boxes, one representing the full HP, the other representing the current HP. However, I've always wanted to make the grid a little more interesting by adding a health bar, using the 100-frame structure, so I can use different colours as the bar gets closer to 0.
And I can't (for the life of me) make the bar go up or down according to the values I type the text boxes.

Anyone...?
(sorry in advance, English is not my main language, but I read better than I write)

If you really want to use frames to show a health bar - you need to find out the percentage of health left and then move the movieclip to that frame. The logic is pretty easy:

var healthFrame = (currentHealth/maxHealth)*100;

healthBar.gotoAndStop(healthFrame);

So literally, frame 1 would be 1% and frame 100 would be 100% of health.

Niallmcfc
Niallmcfc
  • Member since: Aug. 16, 2009
  • Offline.
Forum Stats
Member
Level 09
Gamer
Response to Health Bar & Input Text 2012-02-25 23:49:07 Reply

Also, if you're just typing values into text boxes, you'll need to add some form of update button- once you've typed the value in you press that and it updates the bar.

:: I could make a simple one for you, if you wanted?


Signature? What signature?

Also, any games I plan to make may or may not become vaporware. I'm not good with organizing my life...