Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ==============================================================================
- # ▼▼▼▼▼▼ TroyZ - Loading ▼▼▼▼▼▼
- # ==============================================================================
- # Script by : Agung Prasetyo(TroyZ)
- # Contact me by : - Email agung.endisnear.xyz@gmail.com
- # - Forum RPGMakerID, username TroyZ
- # - Handphone 085756289121
- # Engine : VXAce
- # Level : Easy
- # Version : 1.0
- # ------------------------------------------------------------------------------
- # Change Logs :
- # 12 September 2013 : Version 1.0 released
- # ------------------------------------------------------------------------------
- # How this work :
- # This script allows you to create a loading bar thingy. The loading bar itself
- # can be used by script call. Version 1.0 only allowed you to use this on map
- # screen.
- # ------------------------------------------------------------------------------
- # How to use :
- # Place it between material and main. Also don't forget by having a picture of
- # loading bar base, the loading bar itself, and the loading text. Put that
- # pictures together in the System folder at your project's folder.
- #
- # Use script call to use this script :
- # - SceneManager.call(Agung_Scene_Loading)
- # You can alter the speed of loading by using script call :
- # - loading_speed(value)
- # When value is the new value of speed.
- # ------------------------------------------------------------------------------
- # Compatibility issues :
- # None yet. If you found some, let me know, and bug fixes will come out soon.
- # ------------------------------------------------------------------------------
- # Who to credit :
- # - Allah swt. : For the chance of living that he has given to me.
- # - Nabi Muhammad saw. : As a leader and messenger and prophet of Muslim.
- # I'm proud to be your follower. :)
- # - Agung Prasetyo(TroyZ) : Thats me, of course, the ones that made this script. :P
- # ------------------------------------------------------------------------------
- # License :
- # - Free Game : Just credit those names above.
- # - Commercial Game : Same as free game's license.
- # ------------------------------------------------------------------------------
- $imported = {} if $imported.nil?
- $imported[:TroyZ_Loading] = true
- # ------------------------------------------------------------------------------
- # Configuration of script starts here
- # ------------------------------------------------------------------------------
- module AGUNG
- module LOADING
- LOADING = "Loading.png" # the loading text picture
- LOADING_X = 150 # x position of loading text picture
- LOADING_Y = 100 # y position of loading text picture
- LOADING_BASE = "Loading Bar Base.png" # the loading bar base picture
- LOADING_BASE_X = 20 # x position of loading bar base picture
- LOADING_BASE_Y = 208 # y position of loading bar base picture
- LOADING_BAR = "Loading Bar.png" # the loading bar picture
- SPEED = 5 # speed (in pixel) of loading bar
- end
- end
- # ------------------------------------------------------------------------------
- # End of Configuration
- # ------------------------------------------------------------------------------
- # ------------------------------------------------------------------------------
- # You shall not pass
- # ------------------------------------------------------------------------------
- class Game_System
- attr_accessor :loading_speed
- alias agung_loading_init_x initialize
- def initialize
- agung_loading_init_x
- @loading_speed = AGUNG::LOADING::SPEED
- end
- end
- class Game_Interpreter
- def loading_speed(value)
- $game_system.loading_speed = value
- end
- end
- class Agung_Scene_Loading < Scene_Base
- include AGUNG::LOADING
- def start
- super
- create_background
- @load_bar_duration = 0
- draw_loading_text
- draw_loading_base
- draw_loading_bar
- end
- def draw_loading_text
- @text = Sprite.new
- @text.bitmap = Cache.system(LOADING)
- @text.x = LOADING_X
- @text.y = LOADING_Y
- @text.z = 10
- end
- def create_background
- @background_sprite = Sprite.new
- @background_sprite.bitmap = SceneManager.background_bitmap
- @background_sprite.color.set(16, 16, 16, 128)
- end
- def draw_loading_base
- @load_base = Sprite.new
- @load_base.bitmap = Cache.system(LOADING_BASE)
- @load_base.x = LOADING_BASE_X
- @load_base.y = LOADING_BASE_Y
- @load_base.z = 900
- end
- def draw_loading_bar
- @load_bar_image = Cache.system(LOADING_BAR)
- @load_bar_bitmap = Bitmap.new(@load_bar_image.width, @load_bar_image.height)
- @load_bar_rect = Rect.new(0, 0, @load_bar_duration, @load_bar_image.height)
- @load_bar_bitmap.blt(0, 0, @load_bar_image, @load_bar_rect)
- @load_bar = Sprite.new
- @load_bar.bitmap = @load_bar_bitmap
- @load_bar.x = LOADING_BASE_X
- @load_bar.y = LOADING_BASE_Y
- @load_bar.z = 950
- end
- def update
- super
- @load_bar.bitmap.clear
- @load_bar_rect = Rect.new(0, 0, @load_bar_duration, @load_bar_image.height)
- @load_bar_bitmap.blt(0, 0, @load_bar_image, @load_bar_rect)
- @calc = $game_system.loading_speed
- @load_bar_duration += @calc.to_f
- if @load_bar_duration.to_f > @load_bar_image.width.to_f
- return_scene
- end
- end
- end
- # ------------------------------------------------------------------------------
- # END OF SCRIPT
- # ------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement