Advertisement
AngryPacman

[VXA] Change Fade Time

Jan 31st, 2012
673
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.88 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Change Fade Time (1.0a)
  4. # 23/02/2012
  5. # By Pacman (for Countdown)
  6. # This script will alter the number of frames it takes to fade the screen in
  7. # and out (with the default commands). This is done with a simple script call.
  8. # You can also set an individual fadein or fadeout to have a different number
  9. # of frames.
  10. # Set INITIAL_FRAMES to the number of frames it takes to fade in and out from
  11. # the beginning of the game at line 22.
  12. # Use these script calls to do the functions described next to them:
  13. #   change_fade_time(n)   - Change the number of frames it takes to fade in and
  14. #                           out to n.
  15. #   fadein(n)             - Fade the screen in with n frames.
  16. #   fadeout(n)            - Fade the screen out with n frames.
  17. # Keeping in mind that 60 frames = 1 second.
  18. #
  19. #===============================================================================
  20. #
  21. # BEGIN CONFIGURATION
  22. #
  23.  
  24. module FADE_TIME  # Do not touch this.
  25.   INITIAL_FRAMES = 30 # Starting number of frames.
  26. end               # Do not touch this.
  27.  
  28. #
  29. # END CONFIGURATION
  30. #
  31. #===============================================================================
  32.  
  33. #==============================================================================
  34. # ■ Game_System
  35. #------------------------------------------------------------------------------
  36. #  システム周りのデータを扱うクラスです。セーブやメニューの禁止状態などを保存
  37. # します。このクラスのインスタンスは $game_system で参照されます。
  38. #==============================================================================
  39.  
  40. class Game_System
  41.   #--------------------------------------------------------------------------
  42.   # Public Instance Variables
  43.   #--------------------------------------------------------------------------
  44.   attr_accessor :fade_time
  45.   #--------------------------------------------------------------------------
  46.   # Alias listing
  47.   #--------------------------------------------------------------------------
  48.   alias fade_init initialize
  49.   #--------------------------------------------------------------------------
  50.   # * Object Initialization
  51.   #--------------------------------------------------------------------------
  52.   def initialize(*args)
  53.     fade_init(*args)
  54.     @fade_time = FADE_TIME::INITIAL_FRAMES
  55.   end
  56. end
  57.  
  58. #==============================================================================
  59. # ■ Game_Interpreter
  60. #------------------------------------------------------------------------------
  61. #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
  62. # Game_Troop クラス、Game_Event クラスの内部で使用されます。
  63. #==============================================================================
  64.  
  65. class Game_Interpreter
  66.   #--------------------------------------------------------------------------
  67.   # * Fadeout screen
  68.   #--------------------------------------------------------------------------
  69.   def command_221
  70.     Fiber.yield while $game_message.visible
  71.     screen.start_fadeout($game_system.fade_time)
  72.     wait($game_system.fade_time)
  73.   end
  74.   #--------------------------------------------------------------------------
  75.   # * Fadein screen
  76.   #--------------------------------------------------------------------------
  77.   def command_222
  78.     Fiber.yield while $game_message.visible
  79.     screen.start_fadein($game_system.fade_time)
  80.     wait($game_system.fade_time)
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # * Alter fade time for screen
  84.   #     n : new number of frames fadein and fadeout take.
  85.   #--------------------------------------------------------------------------
  86.   def change_fade_time(n)
  87.     $game_system.fade_time = n
  88.   end
  89.   #--------------------------------------------------------------------------
  90.   # * Fadein with specific number of frames
  91.   #     n : number of frames to fade in by (defaults to set number)
  92.   #--------------------------------------------------------------------------
  93.   def fadein(n = $game_system.fade_time)
  94.     Fiber.yield while $game_message.visible
  95.     screen.start_fadein(n)
  96.     wait(n)
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # * Fadeout with specific number of frames
  100.   #     n : number of frames to fade in by (defaults to set number)
  101.   #--------------------------------------------------------------------------
  102.   def fadeout(n = $game_system.fade_time)
  103.     Fiber.yield while $game_message.visible
  104.     screen.start_fadeout(n)
  105.     wait(n)
  106.   end
  107. end
  108.  
  109. $imported ||= {}
  110. $imported[:pac_change_fade_time]
  111.  
  112. #===============================================================================
  113. #
  114. # END OF SCRIPT
  115. #
  116. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement