Advertisement
Rafael_Sol_Maker

RAFAEL_SOL_MAKER's VX SCENE INTRO (2Kx LOGO) v1.3

Nov 17th, 2011
546
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.68 KB | None | 0 0
  1. #===============================================================================
  2. #              RAFAEL_SOL_MAKER's VX SCENE INTRO (2Kx LOGO) v1.3
  3. #-------------------------------------------------------------------------------
  4. # Description:  Enables the addition of a slide show of images that can also be
  5. #               used as a logo before the title screen, like the one in
  6. #               RPG Maker 2000/2003. You can also select a background music and
  7. #               use as a scene in the map using the specific command.
  8. #-------------------------------------------------------------------------------
  9. # How to Use:
  10. #   All images goes into the folder 'Graphics/Intro/';
  11. #   To use it in-game, use the following command in 'Call Script':
  12. #
  13. #      show_intro (["Image1","OtherImage","Image_N"], "Music",
  14. #                   <wait_time>, <fade_in_time>, <fade_out_time>)
  15. #
  16. # OBS.: Parameters between <> are given in frames, 60 are equal to 1 second;
  17. #       all these parameters are optional.
  18. #       If you don't want a background music just put 'nil' instead.
  19. #-------------------------------------------------------------------------------
  20. # Special Thanks: PRCoders
  21. #-------------------------------------------------------------------------------
  22. #===============================================================================
  23.  
  24. #===============================================================================
  25. # UPDATES
  26. #-------------------------------------------------------------------------------
  27. # VX SCENE INTRO (2Kx LOGO) v1.2 -> v1.3
  28. # * Major structural change, mainly in the music handling, that now are
  29. #     configurated to work together with the graphical fades, and now there is
  30. #     one in the changing of any scene to the intro scene;
  31. # * Now it's  go back to the previus scene correctly, no matter what scene was,
  32. #     instead always going back to the map. It's a fix and could be useful.
  33. # * Now, if it's not specified any music, it will not stop all the musics and
  34. #     sounds that are already running;
  35. # * Other small adjusts allow the background Musics(BGMs) and Background Sounds
  36. #     (BGSs) to have a fadeout and run correctly short after the intro scene;
  37. # * OBS.: The Sound Effects and Music Effects(SE & ME) will be stopped, since
  38. #     the ME got a fadeout. They will not be ran again.
  39. #-------------------------------------------------------------------------------
  40. #===============================================================================
  41.  
  42. class Game_Interpreter  
  43.   def show_intro (pictures, intro_music, wait = 60, fade_in = 60,  fade_out = 60)
  44.     $scene = Scene_Intro.new (pictures, intro_music, wait, fade_in, fade_out)
  45.   end
  46. end
  47.  
  48. module Cache  
  49.   def self.intro(filename)
  50.     load_bitmap('Graphics/Intros/', filename)
  51.   end
  52. end
  53.  
  54. class Scene_Intro < Scene_Base
  55.   include RPG
  56.  
  57.   def initialize (pictures, intro_music, wait_time, fade_in_time, fade_out_time)  
  58.     @pictures = pictures  
  59.     @intro_music = intro_music
  60.     @wait_time = wait_time
  61.     @fade_in_time = fade_in_time  
  62.     @fade_out_time = fade_out_time
  63.    
  64.     unless $scene.nil?
  65.       fade_out_music
  66.       Graphics.fadeout (@fade_out_time)
  67.     else
  68.       update
  69.     end    
  70.   end
  71.  
  72.   def update
  73.     play_intro_music; counter = 0
  74.     @sprite = Sprite.new; @sprite.z = 9999
  75.    
  76.     for image in @pictures
  77.       counter += 1
  78.       Graphics.freeze  
  79.       @sprite.bitmap = Cache.intro(image)
  80.       Graphics.transition(@fade_in_time)
  81.      
  82.       for i in 0...@wait_time
  83.         Graphics.update
  84.         Input.update
  85.         if Input.trigger?(Input::C)          
  86.           break
  87.         elsif Input.trigger?(Input::B)
  88.           # DO_SOMETHING_HERE...?
  89.         end        
  90.       end
  91.       # If it's the last image, let's "erase out" the music;
  92.       fade_out_music if counter == @pictures.size
  93.      
  94.       Graphics.fadeout(@fade_out_time - 5)
  95.       Graphics.wait(5) #Prevent some flicker...      
  96.     end
  97.    
  98.     replay_last_music
  99.     Graphics.freeze    
  100.     @sprite.dispose  unless @sprite.nil?
  101.    
  102.     unless $scene.nil?        
  103.       $scene = $previous_scene
  104.     end
  105.   end    
  106.    
  107.   def fade_out_music
  108.     unless @intro_music == nil  
  109.       time = @fade_out_time * 33.33      
  110.       ME.fade(time); SE.stop  
  111.       Audio.bgm_fade(time); Audio.bgs_fade(time)
  112.     end
  113.   end
  114.  
  115.   def play_intro_music
  116.     unless @intro_music == nil
  117.       Audio.bgm_play ('Audio/BGM/' + @intro_music)
  118.     end
  119.   end
  120.  
  121.   def replay_last_music    
  122.     unless @intro_music == nil
  123.       BGM.last.play
  124.       BGS.last.play
  125.     end
  126.   end
  127.  
  128. end
  129.  
  130. # USE THESE LINES TO CONFIGURE A INTRO BEFORE TITLE SCREEN
  131. if !$TEST
  132.   Scene_Intro.new (["Logo"], nil, 60, 30, 30)
  133. end
  134.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement