Vlue

Variable Message Window

Jun 9th, 2014
91
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Vlue
  2. #Script calls
  3. #  $game_message.set_size(width,height)
  4. #  $game_message.set_position(x,y)
  5. #  $game_message.set(x,y,width,height)
  6. #  $game_message.set_for_event(event_id,width(opt),height(opt))
  7. #  $game_message.set_for_player(width(opt),height(opt))
  8.  
  9. class Game_Message
  10.  
  11.   DEFAULT_WIDTH = Graphics.width
  12.   DEFAULT_HEIGHT = 24*5
  13.   DEFAULT_X = 0
  14.   DEFAULT_Y = Graphics.height-DEFAULT_HEIGHT
  15.  
  16.   attr_reader  :x
  17.   attr_reader  :y
  18.   attr_reader  :width
  19.   attr_reader  :height
  20.   def set_size(width,height)
  21.     @width = width
  22.     @height = height
  23.   end
  24.   def set_position(x,y)
  25.     @x = x
  26.     @y = y
  27.     @x = 0 if @x < 0
  28.     @y = 0 if @y < 0
  29.     @x = Graphics.width - width if @x > Graphics.width - width
  30.     @y = Graphics.height - height if @y > Graphics.height - height
  31.   end
  32.   def set_both(x,y,w,h)
  33.     set_size(w,h)
  34.     set_position(x,y)
  35.   end
  36.   def set_for_event(id, width = DEFAULT_WIDTH, height = DEFAULT_HEIGHT)
  37.     set_size(width,height)
  38.     xx = $game_map.events[id].screen_x - self.width / 2
  39.     yy = $game_map.events[id].screen_y - self.height - 32
  40.     set_position(xx,yy)
  41.     if @y != yy
  42.       set_position(xx, $game_map.events[id].screen_y)
  43.     end
  44.   end
  45.   def set_for_player(width = DEFAULT_WIDTH, height = DEFAULT_HEIGHT)
  46.     set_size(width,height)
  47.     xx = $game_player.screen_x - self.width / 2
  48.     yy = $game_player.screen_y - self.height - 32
  49.     set_position(xx,yy)
  50.   end
  51.   alias variable_clear clear
  52.   def clear
  53.     variable_clear
  54.     @width = DEFAULT_WIDTH
  55.     @height = DEFAULT_HEIGHT
  56.     @x = DEFAULT_X
  57.     @y = DEFAULT_Y
  58.   end
  59. end
  60.  
  61. class Window_Message
  62.   def update_placement
  63.     self.x = $game_message.x
  64.     self.y = $game_message.y
  65.     self.width = $game_message.width
  66.     self.height = $game_message.height
  67.     create_contents
  68.   end
  69.   def adjust_message_window_size
  70.   end
  71. end
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×