RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
A Vertical Gradient bar...

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 88
Menu & Battle System Guru
Does anybody know where i can find one? Or perhaps know how to make one?

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
If you get familiar with any the gradient bar code, you only need to change the width and height values. If it's a more advanced gradient bar, you might need to change the iterating loops as well. For what do you need it? And which size?
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

***
Rep:
Level 88
Menu & Battle System Guru
i was gonna use it for SP in the battlestatus menu

***
Rep:
Level 88
Menu & Battle System Guru
hey i figured it out. But i was wondering how i could split the ends to be diagnol like in other gradient scripts (i think yours [blizzard] SR/SL has split-end gradients).

here's the code for anyone who needs to use it:

Spoiler for:
Code: [Select]
  #--------------------------------------------------------------------------
  # * Draw Vertical Gradient Bar
  #--------------------------------------------------------------------------
  def draw_vertical_gradient_bar(x, y, min, max, file, width = nil, height = nil, hue = 0, back = "Back", back2 = "Back2")
    bar = RPG::Cache.gradient(file, hue)
    back = RPG::Cache.gradient(back)
    back2 = RPG::Cache.gradient(back2)
    cx = BORDER
    cy = BORDER
    dx = OUTLINE
    dy = OUTLINE
    zoom_x = width != nil ? width : back.width
    zoom_y = height != nil ? height : back.height
    percent = min / max.to_f if max != 0
    percent = 0 if max == 0
    bar_y = (zoom_y - zoom_y * percent).ceil
    source_y = bar.height - bar.height * percent
    back_dest_rect = Rect.new(x,y,zoom_x,zoom_y)
    back2_dest_rect = Rect.new(x+dx,y+dy,zoom_x -dx*2,zoom_y-dy*2)
    bar_dest_rect = Rect.new(x+cx,y+bar_y+cy,zoom_x-cx*2,(zoom_y * percent).to_i-cy*2)
    back_source_rect = Rect.new(0,0,back.width,back.height)
    back2_source_rect = Rect.new(0,0,back2.width,back2.height)
    bar_source_rect = Rect.new(0,source_y,bar.width,bar.height * percent)
    self.contents.stretch_blt(back_dest_rect, back, back_source_rect)
    self.contents.stretch_blt(back2_dest_rect, back2, back2_source_rect)
    self.contents.stretch_blt(bar_dest_rect, bar, bar_source_rect)
  end 

  #--------------------------------------------------------------------------
  # * Draw (Vertical)
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  alias trick_draw_actor_STAT draw_actor_STAT
  def draw_actor_STAT(actor, x, y, height = 144)
    # Calculate if there is draw space for MaxSTAT
    if height - 32 >= 108
      STAT_y = y + height - 108
      flag = true
    elsif height - 32 >= 48
      STAT_y = y + height - 48
      flag = false
    end
    height = STAT_y - y
    height += $game_temp.in_battle ? 50 : 100
    percent = actor.STAT / actor.maxSTAT.to_f
    hue = 0
    # Draw SP
    draw_vertical_gradient_bar(x, y-50, actor.STAT, actor.maxSTAT, STAT_BAR, 13, height, hue)
    trick_draw_actor_STAT(actor, x, y, height)
  end

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
You mean the ////// bars or the ||| ||| ||| ||| bars? If you mean the second ones, you can just put a few black rectangles over it. If you mean the first, you have 2 choices:
Either making a code like everybody has with coloring every pixel separately in a double loop with an offset (in a horizontal bar you would need to add a "- i" to the x coordinate...), but that lags OR you could use a trick method I have used to make my bar code efficient: I color them with the normal command for the |||| bars and add some pixeling if needed. The second is harder to code, but definitely lags less.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

***
Rep:
Level 88
Menu & Battle System Guru
i was talking about the ///// and everything u just said went right over my head,  :lol: lol.

***
Rep:
Level 88
Menu & Battle System Guru
sorry for the bump, but would it be possible to use the ///// bars the way i have scripted the vertical gradients?

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
Yes, as I said, you only need to use y-i instead of y. That should make it //// but vertical.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

***
Rep:
Level 88
Menu & Battle System Guru
LOL, i switched the x's and y's for ur soul rage bar and it came out upside down:

Spoiler for:
Code: [Select]
class Bitmap

  def gradient_bar(x, y, w, color1, color2, color3, rate)
    rx = color3.red
    gx = color3.green
    bx = color3.blue
    offset = 8
    x += 27
    y += offset
    r = color1.red
    g = color1.green
    b = color1.blue
    r_rate = color2.red - r
    g_rate = color2.green - g
    b_rate = color2.blue - b
    for i in 0...(offset + 3)
      fill_rect(x+i-2, y-i, w + 3, 1, Color.new(0, 0, 0, 192))
    end
    for i in 0...(offset + 1)
      fill_rect(x+i-1, y-i, w + 1, 1, Color.new(255, 255, 255, 192))
    end
    for i in 0...offset
      red = rx * (offset - i - 1) / offset
      green = gx * (offset - i - 1) / offset
      blue = bx * (offset - i - 1) / offset
      fill_rect(x + i - 1, y - i + 1, w, 1, Color.new(red, green, blue, 192))
    end
    for i in 0...(w * rate).to_i
      for j in 0...offset
        case $bar_style
        when 0
          red = r + r_rate * i / (w * rate)
          green = g + g_rate * i / (w * rate)
          blue = b + b_rate * i / (w * rate)
        when 1
          red = r + r_rate * j / offset
          green = g + g_rate * j / offset
          blue = b + b_rate * j / offset
        end
        set_pixel(x + j - 1, y + i - j + 1, Color.new(red, green, blue, 192))
      end
    end   
  end
end

do you know how could i draw the ///// with this script though?

Spoiler for:
Code: [Select]
  #--------------------------------------------------------------------------
  # * Draw Vertical Gradient Bar
  #--------------------------------------------------------------------------
  def draw_vertical_gradient_bar(x, y, min, max, file, width = nil, height = nil, hue = 0, back = "Back", back2 = "Back2")
    bar = RPG::Cache.gradient(file, hue)
    back = RPG::Cache.gradient(back)
    back2 = RPG::Cache.gradient(back2)
    cx = BORDER
    cy = BORDER
    dx = OUTLINE
    dy = OUTLINE
    zoom_x = width != nil ? width : back.width
    zoom_y = height != nil ? height : back.height
    percent = min / max.to_f if max != 0
    percent = 0 if max == 0
    bar_y = (zoom_y - zoom_y * percent).ceil
    source_y = bar.height - bar.height * percent
    back_dest_rect = Rect.new(x,y,zoom_x,zoom_y)
    back2_dest_rect = Rect.new(x+dx,y+dy,zoom_x -dx*2,zoom_y-dy*2)
    bar_dest_rect = Rect.new(x+cx,y+bar_y+cy,zoom_x-cx*2,(zoom_y * percent).to_i-cy*2)
    back_source_rect = Rect.new(0,0,back.width,back.height)
    back2_source_rect = Rect.new(0,0,back2.width,back2.height)
    bar_source_rect = Rect.new(0,source_y,bar.width,bar.height * percent)
    self.contents.stretch_blt(back_dest_rect, back, back_source_rect)
    self.contents.stretch_blt(back2_dest_rect, back2, back2_source_rect)
    self.contents.stretch_blt(bar_dest_rect, bar, bar_source_rect)
  end 

Code: [Select]
  #--------------------------------------------------------------------------
  # * Draw SP
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  alias trick_draw_actor_sp draw_actor_sp
  def draw_actor_sp(actor, x, y, width = 144)
    # Calculate if there is draw space for MaxHP
    if width - 32 >= 108
      sp_x = x + width - 108
      flag = true
    elsif width - 32 >= 48
      sp_x = x + width - 48
      flag = false
    end
    width = sp_x - x
    width += $game_temp.in_battle ? 50 : 100
    percent = actor.sp / actor.maxsp.to_f
    hue = 0
    # Draw SP
    draw_gradient_bar(x, y + 16, actor.sp, actor.maxsp, SP_BAR, width, 8, hue)
    trick_draw_actor_sp(actor, x, y, width)
  end

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
Below

Code: [Select]
    bar = RPG::Cache.gradient(file, hue)
    back = RPG::Cache.gradient(back)
    back2 = RPG::Cache.gradient(back2)

Add below:

Code: [Select]
    bar.angle += 90
    back.angle += 90
    back2.angle += 90

or

Code: [Select]
    bar.angle -= 90
    back.angle -= 90
    back2.angle -= 90

And the loaded pics will be flipped by 90°.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

***
Rep:
Level 88
Menu & Battle System Guru
darn, it's giving me an undefined method for angle....

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
Argh, forget it. That works only for sprites, not for Bitmaps. =/ I always keep forgetting that. =/ You'll have to iterate through the cached bitmap's width and height and using something like "new_bitmap.set_pixel(y, x, old_bitmap.get_pixel(x, y))" to redraw every pixel from one bitmap to the other. Not that it will be flipped and rotated that way. To only rotate it, you need to use "new_bitmap.set_pixel(new_bitmap.width-y, x, old_bitmap.get_pixel(x, y))" instead.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

***
Rep:
Level 88
Menu & Battle System Guru
lol, alright i'll try it. thanks blizz!