Advertisement
DrDhoom

Splash Screen

Jul 6th, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.10 KB | None | 0 0
  1. module Dhoom
  2.   module SplashScreen
  3.     Splash_Graphics = ["splash","splash2"]
  4.     Splash_Total = [9,4]
  5.     Splash_Speed = 10
  6.     Splash_Wait = 60
  7.   end
  8. end
  9.  
  10. module SceneManager
  11.   def self.first_scene_class
  12.     $BTEST ? Scene_Battle : Scene_Splash
  13.   end
  14. end
  15.  
  16. class Scene_Splash < Scene_Base
  17.   include Dhoom::SplashScreen
  18.   def start
  19.     super
  20.     Graphics.freeze
  21.     @index = 0
  22.     @seq = 0
  23.     @sec = 0
  24.     create_splash_graphics
  25.   end
  26.  
  27.   def create_splash_graphics    
  28.     @splash_graphics = Sprite.new
  29.   end
  30.  
  31.   def update
  32.     super
  33.     if @sec > 0
  34.       @sec -= 1
  35.     else
  36.       update_splash_graphics
  37.     end
  38.   end
  39.  
  40.   def update_splash_graphics    
  41.     if @index > Splash_Graphics.size-1
  42.       SceneManager.call(Scene_Title)
  43.       return
  44.     end
  45.     if @seq < Splash_Total[@index]
  46.       @seq += 1
  47.       @splash_graphics.bitmap = Cache.system(Splash_Graphics[@index]+"_"+@seq.to_s)
  48.       @sec = Splash_Speed
  49.     else
  50.       @seq = 0
  51.       @index += 1
  52.       @sec = Splash_Wait      
  53.     end
  54.   end
  55.  
  56.   def terminate
  57.     super
  58.     @splash_graphics.dispose
  59.   end
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement