Advertisement
roninator2

Yato - Window Message Pause Icon updated

Dec 4th, 2024
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.58 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. #==============================================================================
  3. # Window Message Pause Icon
  4. # Created: 11/11/2013 by Yato (Racheal)
  5. # Updated: 27/06/2018 by Leonardo Ark (ArkDG)
  6. # Modded: 25/06/2019 by roninator2
  7. # Instructions:
  8. # * Insert in the Materials section
  9. # * Configure to your liking below
  10. #==============================================================================
  11. # Compatibility:
  12. # This script is for RPG Maker VX Ace
  13. #==============================================================================
  14. =begin
  15. Originally designed by Yato(Racheal) and modified by me (Leonardo Ark)
  16. Release Date: 06/27/2018
  17.  
  18. Yato's profile at RPGMakerWeb.com: https://forums.rpgmakerweb.com/index.php?members/yato.587/
  19. PLEASE, Credit her in your game, not me.
  20.  
  21. Set the variable you wish to use for the position and the variable name.
  22. Change the icon by changing the variable. Must be in quotes
  23.  
  24. Terms of Use
  25. * Contact Yato for commercial use
  26. * No real support. The script is provided as-is
  27. * No bug fixes, no compatibility patches
  28. * Preserve this header
  29.  
  30. =end
  31.  
  32. class Window_Message < Window_Base
  33.  
  34. ####### CUSTOMIZATION HERE #######
  35. @@sprite_name = "pauseicon" #should be in /Graphics/System - Must be in quotes "pauseicon"
  36. @@sprite_var = 11 #variable used to change the graphic file
  37. @@sprite_cell_width = 16 #the original is 16, but you can make a img with any cell size
  38. @@sprite_cell_height = 16 #the original is 16, but you can make a img with any cell size
  39. @@pause_pos_x = 12 #start at right corner of the screen. The higher the number, more to the left
  40. @@pause_pos_y = 4 #start at bottom of the screen. The higher the number, more to the top
  41. @@pause_var = 10 #variable to set position. 0 = right, 1 = center, 2 = left
  42. #### END OF THE CUSTOMIZATION ####
  43. @@sprite_pause = nil
  44.  
  45. #--------------------------------------------------------------------------
  46. # * Initialize
  47. #--------------------------------------------------------------------------
  48.   alias move_pause_graphic_initialize initialize
  49.   def initialize
  50.     if $game_variables[@@sprite_var] != @@sprite_pause
  51.       $game_variables[@@sprite_var] = @@sprite_name
  52.       @@sprite_pause = @@sprite_name
  53.     end
  54.     move_pause_graphic_initialize
  55.     make_pause_sprite
  56.   end
  57. #--------------------------------------------------------------------------
  58. # * Free
  59. #--------------------------------------------------------------------------
  60.   alias move_pause_graphic_dispose dispose
  61.   def dispose
  62.     move_pause_graphic_dispose
  63.     @pause_sprite.dispose
  64.   end
  65. #--------------------------------------------------------------------------
  66. # * Make Pause Sprite
  67. #--------------------------------------------------------------------------
  68.   def make_pause_sprite
  69.     @pause_sprite = Sprite.new
  70.     @pause_sprite.bitmap = Cache.system(@@sprite_pause)
  71.     @pause_sprite.src_rect = Rect.new(0, 0, @@sprite_cell_width, @@sprite_cell_height)
  72.     @pause_sprite.z = self.z + 10
  73.     @pause_sprite.visible = false
  74.   end
  75. #--------------------------------------------------------------------------
  76. # * Frame Update
  77. #--------------------------------------------------------------------------
  78.   alias move_pause_graphic_update update
  79.   def update
  80.     if $game_variables[@@sprite_var] != @@sprite_pause
  81.       @@sprite_pause = $game_variables[@@sprite_var]
  82.       @pause_sprite.dispose
  83.       make_pause_sprite
  84.     end
  85.     move_pause_graphic_update
  86.     update_pause_sprite if @pause_sprite.visible
  87.   end
  88. #--------------------------------------------------------------------------
  89. # * Frame Update
  90. #--------------------------------------------------------------------------
  91.   def update_pause_sprite
  92.     frame = Graphics.frame_count % 60 / 15
  93.     @pause_sprite.src_rect.x = 0 + @@sprite_cell_width * (frame % 2)
  94.     @pause_sprite.src_rect.y = 0 + @@sprite_cell_height * (frame / 2)
  95.   end
  96. #--------------------------------------------------------------------------
  97. # * Set Pause
  98. #--------------------------------------------------------------------------
  99.   def pause=(pause)
  100.     if $game_variables[@@pause_var] == 0
  101.       @pause_sprite.x = self.x + self.width - padding - @@pause_pos_x
  102.       @pause_sprite.y = self.y + self.height - padding - @@pause_pos_y
  103.       @pause_sprite.visible = pause
  104.     elsif $game_variables[@@pause_var] == 1
  105.       @pause_sprite.x = Graphics.width / 2
  106.       @pause_sprite.y = self.y + self.height - padding - @@pause_pos_y
  107.       @pause_sprite.visible = pause
  108.     else
  109.       @pause_sprite.y = self.y + self.height - padding - @@pause_pos_y
  110.       @pause_sprite.visible = pause
  111.     end
  112.   end
  113. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement