[RESOLVED]% bars

Started by Ryex, May 31, 2008, 08:24:13 pm

Previous topic - Next topic

Ryex

May 31, 2008, 08:24:13 pm Last Edit: July 25, 2008, 05:03:43 pm by Starrodkirby86
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?
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Ryex

odd... I was sure i'd read the thing quite throughly 

any idea what section its in? that might help me find it.
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Juan

June 02, 2008, 06:44:31 pm #3 Last Edit: June 02, 2008, 06:45:41 pm by Juan
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?

Dropbox Who need luck when you can make your own.
3ds Friend code: ShowHide
 4468 1422  6617

Ryex

I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Ryex

June 03, 2008, 07:23:04 pm #5 Last Edit: June 03, 2008, 07:23:35 pm by Ryex
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?
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

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.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Ryex

 :o wow now that is simple I understand that completly!
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

Blizzard

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

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.