Charas-Project

  • Home
  • Help
  • Search
  • Calendar
  • Login
  • Register
*
Please login or register.

Login with username, password and session length
 

News:

Click here to join us on IRC (#charas on irc.freenode.net)!



  • Charas-Project »
  • Game Creation »
  • Requests »
  • Tutorials »
  • How do I make a Health Bar?
« previous next »
  • Print
Pages: [1]

Author Topic: How do I make a Health Bar?  (Read 2826 times)

Offline Koopapooper

  • The Smarterchild
  • Associate
  • *
  • Posts: 162
  • I'm a Male.
How do I make a Health Bar?
« on: May 29, 2007, 11:21:29 AM »
I have made a custom Battle..but I dont have a bar of health or MP
so..Please tell me how to do this .

DONT REPLY UNLESS ITS ADVICE PLEASE.
Logged
I am ferior.

Offline DragonBlaze

  • A Wild DB Appeared!
  • Royal
  • *
  • Posts: 3,329
(No subject)
« Reply #1 on: May 30, 2007, 02:42:30 AM »
Ok, how many pictures do you have for the bar? Well lets say you have 20 (if you don't, just replace 20 with the number you have).

First off, set a variable to the current hp, lets call it [hp percent]. Multiply it by 19 (or one less than the number of pictures you have 20-1 = 19), then divide it by the hero's total hp. This will make [hp percent] equal to the percent of the heros life life.

Now make 20 conditional branches. One for if [hp percent = 0] (show the empty bar), one for if its one (show the almost empty bar, and keep going up from there. In the end, it should look like this.

set [hp percent] = current hp
multiply [hp percent] by 19
divide [hp percent] by total hp

if [hp percent] less than or equal to 0
- show picture, empty bar
if [hp percent] = 1
- show picture, almost empty bar

...

if [hp percent] = 19
-show full bar

The reason you have to do it one less than the number of pictures you have is because you need to count 0 as a number. so even though you're only going up to 19, you're counting 0 too, and 0 + 1-19 = 20 numbers.
Logged
Hell Yeah! Just recovered all my old rm2k/3 games from my 10 year old, broken laptop hard drive that had been formatted and had a new OS installed on it. Oh, and I did all of this from my phone. WIN

Offline danielturipa

  • Daniel Turipa
  • Initiate
  • *
  • Posts: 93
  • i love guitar and rm2k3
(No subject)
« Reply #2 on: June 18, 2007, 02:14:41 AM »
First Off. Open The DataBase.
Go Through Common Event's
Now Open Up The Event Commands,
Now Look For The Conditional Branch
and go to page 2 and click on heroFirst Off.
And Now Hero Hp At Least Write How Much You want.
And Make It A Parallel or a Call
If Its A Call You Can Recieve the Hp Bar Through The Game.

I Have 1500hp and the monsters take 100 damage or less
and You Put your Hp into groups Of 100's For Each Picture.
And You Might Want 1 Picture For Each 100hp
Heres And Example

Quote
Originally posted by danielturipa

<>Branch if ???Hp is 1500 or more
  <>Show Picture:1Hp Bar15.(117,27)
  <>
:Else Handler
  <>Branch if ???Hp is 1400 or more
    <>Show Picture:1Hp Bar14.(117,27)
    <>
:Else Handler
  <>
 :End
 <>
 :End




And Now Put Them All Into Groups
I Could Give You A Link to My Project And Steal My Ideas.
BUT! If You Do Find Out How To Use This
You Can Also Use Them For You Facesets To.
And Mp Bar And Hp Bar.

Well I Hoped This Helped
Logged
http://i104.photobucket.com/albums/m184/_MiLeNe_/CaramellDansen.gif

the person below me is gay
--------------------V

Offline DragonBlaze

  • A Wild DB Appeared!
  • Royal
  • *
  • Posts: 3,329
(No subject)
« Reply #3 on: June 18, 2007, 04:23:47 AM »
Thats not a very good way of doing it, cuz you have that script designed for a specific hp amount, and thus have to make a seperate script for each level. A better way to do it is to base it off of percentages.
Logged
Hell Yeah! Just recovered all my old rm2k/3 games from my 10 year old, broken laptop hard drive that had been formatted and had a new OS installed on it. Oh, and I did all of this from my phone. WIN

Offline danielturipa

  • Daniel Turipa
  • Initiate
  • *
  • Posts: 93
  • i love guitar and rm2k3
(No subject)
« Reply #4 on: June 19, 2007, 01:15:33 AM »
well im still learning how to code my own stuff.
and i reckon this is a good hp bar if its through out
the whole game.
Logged
http://i104.photobucket.com/albums/m184/_MiLeNe_/CaramellDansen.gif

the person below me is gay
--------------------V

  • Print
Pages: [1]
« previous next »
  • Charas-Project »
  • Game Creation »
  • Requests »
  • Tutorials »
  • How do I make a Health Bar?
 

  • SMF 2.0.10 | SMF © 2015, Simple Machines
  • XHTML
  • 2O11
  • RSS
  • WAP2
  • Simple Machines Forum