Advertisement
roninator2

XaiL System - Image Shake by variable setting

Dec 4th, 2024
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.94 KB | None | 0 0
  1. #==============================================================================
  2. #   XaiL System - Image Shake
  3. #   Author: Nicke
  4. #   Created: 25/08/2012
  5. #   Edited: 03/09/2012
  6. #   Version: 1.0a
  7. #==============================================================================
  8. # Instructions
  9. # -----------------------------------------------------------------------------
  10. # To install this script, open up your script editor and copy/paste this script
  11. # to an open slot below ? Materials but above ? Main. Remember to save.
  12. #
  13. # Small snippet to make your picture's shake when the screen is shaking.
  14. # changes the script so that it uses a variable to control the shaking
  15. # and not the setting in the original script.
  16. # *** Only for RPG Maker VX Ace. ***
  17. #==============================================================================
  18. ($imported ||= {})["XAIL-IMAGE-SHAKE"] = true
  19.  
  20. module XAIL
  21.   module IMG_SHAKE
  22.   #--------------------------------------------------------------------------#
  23.   # * Settings
  24.   #--------------------------------------------------------------------------#
  25.     # Use this to setup which direction the pictures should move when a shaking
  26.     # occurs.
  27.     # x = horizontal
  28.     # y = vertical
  29.     # xy = both
  30.     # "" = none
  31.     # SHAKE_DIRECTION = strng # variable
  32.     # make the variable equal to one of the string options.
  33.     SHAKE_DIRECTION = 1     #"xy"   Roninator2 edit
  34.         # changed to allow changing the setting in game with a variable
  35.         # if the variable is not set, the default is xy
  36.    
  37.     # Switch to manually enable/disable the script.
  38.     # This will disable the script if switch_id is on/true.
  39.     # DISABLE_PIC_SHAKE = switch_id
  40.     DISABLE_PIC_SHAKE = 1
  41.    
  42.   end
  43. end
  44. # *** Don't edit below unless you know what you are doing. ***
  45. #==============================================================================#
  46. # ** Module Sound
  47. #==============================================================================#
  48. class Spriteset_Map
  49.  
  50.     alias xail_img_shake_spriteset_map_upd_viewports update_viewports
  51.     def update_viewports(*args, &block)
  52.       # // Method to when viewports are updating.
  53.       xail_img_shake_spriteset_map_upd_viewports(*args, &block)
  54.             if $game_variables[XAIL::IMG_SHAKE::SHAKE_DIRECTION] != "x" || "y" || "xy" || ""
  55.             # roninator2 edit
  56.                 $game_variables[XAIL::IMG_SHAKE::SHAKE_DIRECTION] = "xy"
  57.             end
  58.       return if $game_switches[XAIL::IMG_SHAKE::DISABLE_PIC_SHAKE]
  59.       case XAIL::IMG_SHAKE::SHAKE_DIRECTION
  60.       when "x"
  61.         @viewport2.ox = $game_map.screen.shake
  62.       when "y"
  63.         @viewport2.oy = $game_map.screen.shake
  64.       when "xy"  
  65.         @viewport2.ox = $game_map.screen.shake
  66.         @viewport2.oy = $game_map.screen.shake
  67.       end
  68.     end
  69.    
  70. end # END OF FILE
  71.  
  72. #=*==========================================================================*=#
  73. # ** END OF FILE
  74. #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement