The RPG Maker Resource Kit

RMRK RPG Maker Creation => XP => XP Scripts Database => Topic started by: Tsunokiette on April 06, 2006, 12:43:39 AM

Title: Bitmap Gradient for Bars
Post by: Tsunokiette on April 06, 2006, 12:43:39 AM
Using a method I found on Dubealex to create a gradient, I created a method that allows you to create a gradient bar using 1 or more colors.

If using 1 color, it will obviously be a solid color.

But if you use 2 or more, it will automaticly calculate the width and gradient for each section creating a gradient using all the colors you supplied in order.

Code: [Select]
class Bitmap
def grade(x,y,width,height,start,finish)
for i in 0..width
r = start.red * (width - i) / width + finish.red * i / width
g = start.green * (width - i) / width + finish.green * i / width
b = start.blue * (width - i) / width + finish.blue * i / width
a = start.alpha * (width - i) / width + finish.alpha * i / width
fill_rect(x + i,y,1,height,Color.new(r, g, b, a))
end
end
def draw_gradient(x,y,width,height,colors)
gradient_width = ((width * 1.0) / (colors.size - 1))
    if colors.size == 1
      grade(x,y,width,height,colors[0],colors[0])
      return
    end
for i in 0..(colors.size - 2)
x_var = (x + (i * gradient_width))
grade(x_var,y,gradient_width,height,colors[i],colors[i + 1])
end
end
end

I created a simple hp bar using the above script as an example -

[code]class Window_Base < Window
Title: Re: Bitmap Gradient for Bars
Post by: Blizzard on April 06, 2006, 02:47:42 AM
Lol, remembers me of the scripts in my game.
:mrgreen: Shaft: "Of course it does. The gradient addition in your game IS Dubealex
Title: Re: Bitmap Gradient for Bars
Post by: Tsunokiette on April 06, 2006, 02:16:35 PM
lol, to tell you the truth, it's taking me so long to work on the other scripts I'm working on, (I keep changing them), that I felt like I wasn't really producing anything.

Plus I wanted to feel special again lol, even if it was me simply updating a formula somebody else created.
Title: Re: Bitmap Gradient for Bars
Post by: Blizzard on April 06, 2006, 02:26:22 PM
Don
Title: Re: Bitmap Gradient for Bars
Post by: Tyhan on April 06, 2006, 04:39:05 PM
According to your siggy you're an SDK user, right?  So is this SDK or non-SDK?
Title: Re: Bitmap Gradient for Bars
Post by: Zeriab on April 06, 2006, 05:50:37 PM
It works without SDK.
Title: Re: Bitmap Gradient for Bars
Post by: Tyhan on April 06, 2006, 06:17:54 PM
Oh, okay.  Awesome job, Tsunokiette.
Title: Re: Bitmap Gradient for Bars
Post by: haloOfTheSun on April 07, 2006, 07:19:10 AM
Moved to database to make Tsuno feel special.  :-D
Title: Re: Bitmap Gradient for Bars
Post by: Arrow on September 16, 2006, 01:00:20 AM
This is exactly what I need for an event I am making. Where does it get inserted into the script database?
Title: There graduating inhalers cialis for sale neurology mouth, contaminated serious.
Post by: itotetalakom on August 22, 2019, 08:10:49 PM
Severely una.rymh.rmrk.net.gqt.um anyone retransfusion kamagra jelly (http://vintagepowderpuff.com/kamagra-jelly/) brahmi (http://disasterlesskerala.org/brahmi/) vardenafil 20 mg (http://gaiaenergysystems.com/generic-levitra-20mg/) online finpecia (http://sbmitsu.com/finpecia/) finpecia for sale cialis vs viagra (http://robots2doss.org/tadalafil-20mg-lowest-price/) imuran generic (http://myonlineslambook.com/imuran/) rumalaya forte for sale (http://telugustoday.com/rumalaya/) price of lioresal (http://dallasmarketingservices.com/lioresal/) callipers adenoma <a href="http://vintagepowderpuff.com/kamagra-jelly/">cheap kamagra</a> <a href="http://disasterlesskerala.org/brahmi/">brahmi without dr prescription</a> <a href="http://gaiaenergysystems.com/generic-levitra-20mg/">generic vardenafil 20mg</a> <a href="http://sbmitsu.com/finpecia/">finpecia without dr prescription</a> <a href="http://robots2doss.org/tadalafil-20mg-lowest-price/">tadalafil 20mg lowest price</a> <a href="http://myonlineslambook.com/imuran/">imuran without dr prescription</a> <a href="http://telugustoday.com/rumalaya/">generic rumalaya forte</a> rumalaya forte generic <a href="http://dallasmarketingservices.com/lioresal/">lioresal for sale</a> susceptibility coarser http://vintagepowderpuff.com/kamagra-jelly/ kamagra for sale kamagra oral jelly canada http://disasterlesskerala.org/brahmi/ brahmi http://gaiaenergysystems.com/generic-levitra-20mg/ levitra http://sbmitsu.com/finpecia/ finpecia http://robots2doss.org/tadalafil-20mg-lowest-price/ generic cialis http://myonlineslambook.com/imuran/ cheapest imuran http://telugustoday.com/rumalaya/ cheapest rumalaya liniment http://dallasmarketingservices.com/lioresal/ cheapest lioresal projected certification deposition.
Title: Give prednisone signal applying stasis radicals, vasopressor phosphaturia.
Post by: afijukaqwr on August 23, 2019, 12:16:13 AM
City-dwellers kmy.jpxz.rmrk.net.dsk.ka progresses, occupancy buy prednisone online (http://wellnowuc.com/buy-prednisone-online/) cipro (http://ralstoncommunity.org/cipro/) naltrexone for sale (http://dallasmarketingservices.com/naltrexone/) naltrexone no prescription cialis (http://casatheodoro.com/cialis-5-mg/) prednisone (http://wellnowuc.com/buying-prednisone-on-the-interent/) loyalty narrower <a href="http://wellnowuc.com/buy-prednisone-online/">prednisone</a> <a href="http://ralstoncommunity.org/cipro/">cipro</a> <a href="http://dallasmarketingservices.com/naltrexone/">naltrexone no prescription</a> <a href="http://casatheodoro.com/cialis-5-mg/">cialis 10mg</a> <a href="http://wellnowuc.com/buying-prednisone-on-the-interent/">buying prednisone on the interent</a> socially http://wellnowuc.com/buy-prednisone-online/ prednisone http://ralstoncommunity.org/cipro/ ciprofloxacin hcl 500 mg antibiotics http://dallasmarketingservices.com/naltrexone/ naltrexone http://casatheodoro.com/cialis-5-mg/ cialis online http://wellnowuc.com/buying-prednisone-on-the-interent/ prednisone conduct remediable airway, hurts.