Chaos Project

RPG Maker => RPG Maker Scripts => Topic started by: Ryex on May 31, 2008, 08:24:13 pm

Title: [RESOLVED]% bars
Post by: Ryex on May 31, 2008, 08:24:13 pm
hello every one I'm finally getting back to making my CMS and I wanted to put bars in but I realized after looking at many examples that I don't know how they work

so I was wondering if any one could make a very simple example of a solid color bar that fills based on the % health/MP/EXP of the actor? and explain how it works? and if you feel you have the time explain it line by line?
Title: Re: % bars
Post by: Blizzard on June 02, 2008, 05:51:07 am
http://forum.chaos-project.com/index.php?topic=22.0

I made an example in there. :3
Title: Re: % bars
Post by: Ryex on June 02, 2008, 06:30:53 pm
odd... I was sure i'd read the thing quite throughly 

any idea what section its in? that might help me find it.
Title: Re: % bars
Post by: Juan on June 02, 2008, 06:44:31 pm
Its in the section thats in bold.
5. Lag-weg
5.1. Algorithm Complexity

5.2. What lags and why it lags (RGSS specific)

5.3. Decrease Process Time

5.4. Don't fear more Code

5.5. RAM or CPU?

Title: Re: % bars
Post by: Ryex on June 02, 2008, 07:45:28 pm
thanks Juan
Title: Re:% bars
Post by: Ryex on June 03, 2008, 07:23:04 pm
ok I found the example but even reading the comments I still cant understand what "exactly" the script is doing. for example I know when it is drawing a rectangle that is "so big" by "so big" and is "such and such" color. and I understand when it is defining a color value to a a variable bu the rest is just a bunch of lines in the mud I TINHK I know what the purpose is but what it is doing and how it is doing it are beyond me.

so I think I should start simpler. can you make a code that draws a % bar that is one solid color not red on on side the transitioning to yellow?
Title: Re: % bars
Post by: Blizzard on June 04, 2008, 05:43:50 am
Then just try something like:

rate = actor.hp * 100 / actor.maxhp
self.contents.fill_rect(x, y, rate * MAXWIDTH / 100, 12, Color.new(255, 255, 0))


instead of all the code there. Or simply only

self.contents.fill_rect(x, y, rate * w / 100, 12, Color.new(255, 255, 0))


if you are using that draw_bar method or however I called it.
Title: Re: % bars
Post by: Ryex on June 04, 2008, 06:28:37 pm
 :o wow now that is simple I understand that completly!
Title: Re: [Resolved]% bars
Post by: Blizzard on June 07, 2008, 04:45:35 am
Oops! If you use my method, you need this here. xD

self.contents.fill_rect(x, y, rate * w, 12, Color.new(255, 255, 0))


My bad. xD