03-07-2008, 06:26 AM
Icon Bar
Version: 1.1
Version: 1.1
Introduction
This is a really simple script I wrote for my game and I thought that it might be useful for some other people. Basically, it makes a bar out of two different icons, an empty and a full one. It splits the icons into halves and makes a bar out of them (think the Zelda life bar with full, half, and empty hearts).
Screenshots
I probably should have chosen better icons, but it should be visible. See that the top one has three and a half lighter diamonds, the second has three, and the other two have none.
Demo
Hopefully the instructions are clear enough, but if not, here's a demo that will show you how to use the script in a window.
Script
Content Hidden
Copy and paste above main. To call it in a window, first make sure that "self.contents" is defined as a Bitmap. You shouldn't get an error if you don't, but it won't draw the bar. Then, call it with "draw_icon_bar(**arguments**<arguments>)". The arguments are:</arguments>
- x (required): The x position of the icon farthest to the left.
- y (required): The y position of all of the icons.
- value (required): The number of half icons that are full.
- max (required): The number of half icons total.
- filled (optional): The name (as a string) of the "filled" icon. Defaults to "Filled".
- empty (optional): The name (as a string) of the "empty" icon. Defaults to "Empty".
- "value" and "max" are the number of half icons, so for 5 1/2 out of 8 icons filled, use value = 11 and max = 16.
- If you don't define "filled" and "empty" when you call it, make sure that you have icons in your icon folder called "Filled" and "Empty" (case sensitive, I believe).
Unless you have another def in Window_Base called "draw_icon_bar," you shouldn't have problems.
Author's Notes
If anyone has good icons for this script, it would be nice if you'd post them for other people to use. I'm afraid I'm a horrible artist, and the icons in the demo/screenshot aren't mine (I actually can't remember where I got them).
Terms and Conditions
Credit's really not needed. It took me all of five minutes.