Advertisement
TmanDaCool1

Untitled

Apr 19th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. class Floating_Location < Window_Base
  2.  
  3. def initialize
  4. @map_name = get_name
  5. @size = Win_Size.new(@map_name)
  6. width = @size[0]
  7. height = @size[1]
  8. super(0, 0, width+32, height+32)
  9. self.contents = Bitmap.new(width, height)
  10. self.opacity = 240#Box line opacity
  11. self.back_opacity = 240#Back box opacity
  12. self.contents_opacity = 240
  13. @frame_wait = Graphics.frame_count + 80#Duration
  14. refresh
  15. end
  16.  
  17. def refresh
  18. if get_name == "noname"
  19. self.dispose
  20. return
  21. end
  22. self.contents.font.color = Color.new(255,255,255,255)#RGB Colour of text
  23. self.contents.draw_text(0, 0, @size[0]+32, @size[1], @map_name)
  24. end
  25.  
  26. def update
  27. if get_name != @map_name
  28. self.dispose
  29. return
  30. end
  31. if @frame_wait <= Graphics.frame_count
  32. if self.opacity > 0
  33. self.opacity -= 20#Duration
  34. self.back_opacity -= 20#Duration
  35. self.contents_opacity -= 20#Duration
  36. else
  37. self.dispose
  38. return
  39. end
  40. end
  41. end
  42.  
  43. def get_name
  44. data = load_data("Data/MapInfos.rxdata")
  45. data[$game_map.map_id].name
  46. end
  47.  
  48. end
  49.  
  50. class Win_Size < Window_Base
  51.  
  52. def initialize(text)
  53. super(0, 0, 640, 480)
  54. self.contents = Bitmap.new(640 - 32, 480 - 32)
  55. @w = contents.text_size(text).width
  56. @h = contents.text_size(text).height
  57. self.dispose
  58. end
  59.  
  60. def [](value)
  61. if value == 0
  62. return @w
  63. else
  64. return @h
  65. end
  66. end
  67.  
  68. end
  69.  
  70. class Scene_Map
  71.  
  72. alias :main_orig :main
  73. alias :update_orig :update
  74. alias :transfer_player_orig :transfer_player
  75.  
  76. def main
  77. @floating_location.dispose unless @floating_location.nil?
  78. @floating_location = Floating_Location.new
  79. main_orig
  80. @floating_location.dispose unless (@floating_location.disposed? or
  81. @floating_location.nil?)
  82. end
  83.  
  84. def update
  85. @floating_location.update unless (@floating_location.disposed? or
  86. @floating_location.nil?)
  87. update_orig
  88. end
  89.  
  90. def transfer_player
  91. transfer_player_orig
  92. @floating_location.dispose unless (@floating_location.disposed? or
  93. @floating_location.nil?)
  94. @floating_location = Floating_Location.new
  95. end
  96. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement