Advertisement
neutale

Map Name Display Background

Oct 11th, 2018
658
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.73 KB | None | 0 0
  1. #==============================================================================
  2. # ■ Map Name Display Background
  3. #  MapNameBgImage.rb
  4. #------------------------------------------------------------------------------
  5. #  You can specify an image file for map name display as a background.
  6. #
  7. # ●How to use
  8. # 1. Prepare an image you want to use for the background image and place it in
  9. # "Graphics \ Pictures" folder.
  10. # 2. Set the file name to the variable after "@@back_ground_filename" in the
  11. # user defined area (below).
  12. #
  13. # ●Terms of Service:
  14. #  It's possible to modify and redistribute without permission from the author.
  15. #  And this script licensed under MIT License.
  16. #-----------------------------------------------------------------------------
  17. # Copyright (c) 2015 Triacontane
  18. # This software is released under the MIT License.
  19. # http://opensource.org/licenses/mit-license.php
  20. #-----------------------------------------------------------------------------
  21. # Version
  22. # 1.0.0 2016/02/24 First release
  23. # ----------------------------------------------------------------------------
  24. # [Blog]   : http://triacontane.blogspot.jp/
  25. # [Twitter]: https://twitter.com/triacontane/
  26. # [GitHub] : https://github.com/triacontane/
  27. #=============================================================================
  28.  
  29. #==============================================================================
  30. # ■ Window_MapName
  31. #------------------------------------------------------------------------------
  32. #  Window that displays a map name
  33. #==============================================================================
  34. class Window_MapName
  35.   #--------------------------------------------------------------------------]
  36.   # ● User defined area Start
  37.   # Input an image file name where you want to use as a background image here.
  38.   #--------------------------------------------------------------------------
  39.   @@back_ground_filename = "background.png"
  40.   #--------------------------------------------------------------------------
  41.   # ● User defined area End
  42.   #--------------------------------------------------------------------------
  43.   #--------------------------------------------------------------------------
  44.   # ● Update fade-in
  45.   #--------------------------------------------------------------------------
  46.   alias mapname_bgimage_update_fadein update_fadein
  47.   def update_fadein
  48.     mapname_bgimage_update_fadein
  49.     @bg_sprite.opacity += 16 if @bg_sprite != nil
  50.   end
  51.   #--------------------------------------------------------------------------
  52.   # ● Update fade-out
  53.   #--------------------------------------------------------------------------
  54.   alias mapname_bgimage_update_fadeout update_fadeout
  55.   def update_fadeout
  56.     mapname_bgimage_update_fadeout
  57.     @bg_sprite.opacity -= 16 if @bg_sprite != nil
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # ● Draw background
  61.   #--------------------------------------------------------------------------
  62.   alias mapname_bgimage_draw_background draw_background
  63.   def draw_background(rect)
  64.     if @@back_ground_filename == ""
  65.       mapname_bgimage_draw_background(rect)
  66.     else
  67.       @bg_sprite = Sprite.new
  68.       @bg_sprite.bitmap = Cache.picture(@@back_ground_filename)
  69.       @bg_sprite.opacity = 0
  70.       @bg_sprite.x = (self.x + self.width  / 2) - @bg_sprite.bitmap.width  / 2
  71.       @bg_sprite.y = (self.y + self.height / 2) - @bg_sprite.bitmap.height / 2
  72.       @bg_sprite.z = self.z - 1
  73.     end
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # ● Release
  77.   #--------------------------------------------------------------------------
  78.   def dispose
  79.     super
  80.     @bg_sprite.dispose if @bg_sprite != nil
  81.   end
  82. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement