Advertisement
Skyloftian_Link

RGSS3 - Loading Bar Example

May 27th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.86 KB | None | 0 0
  1. class Scene_Title < Scene_Base
  2.  
  3.   def start
  4.     super
  5.     SceneManager.goto(Scene_LoadBar)
  6.   end
  7.  
  8.   def terminate
  9.     super
  10.   end
  11.  
  12. end
  13.  
  14. class Scene_LoadBar < Scene_Base
  15.  
  16.   def start
  17.     super
  18.     @width_ldbar = 0
  19.     draw_barrinha
  20.   end
  21.  
  22.   def draw_barrinha
  23.     @width_ldbar += 1
  24.     @height_ldbar = 25
  25.     @color_ldbar = Color.new(255, 0, 0)
  26.     @loading_bar = Sprite.new
  27.     @loading_bar.bitmap = Bitmap.new(@width_ldbar, @height_ldbar)
  28.     @loading_bar.x = (Graphics.width - 450) / 2
  29.     @loading_bar.y = (Graphics.height - @height_ldbar) / 2
  30.     @loading_bar.z = 999
  31.     @loading_bar.bitmap.fill_rect(0, 0, @width_ldbar, @height_ldbar, @color_ldbar)
  32.   end
  33.  
  34.   def refresh
  35.     @loading_bar.dispose
  36.     draw_barrinha
  37.   end
  38.  
  39.   def update
  40.     super
  41.     if @width_ldbar < 450 ; refresh
  42.     else ; @width_ldbar = 0 ; end
  43.   end
  44.  
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement