Advertisement
DizzyFoxkit

CMS moving left and up

May 23rd, 2012
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.88 KB | None | 0 0
  1. class Window_Base < Window
  2.    
  3. def initialize(x, y, width, height)
  4.     super()
  5.     @windowskin_name = $game_system.windowskin_name
  6.     self.windowskin = RPG::Cache.windowskin(@windowskin_name)
  7.     self.x = x
  8.     self.y = y
  9.     self.width = width
  10.     self.height = height
  11.     self.z = 100
  12.     @dest_x = self.x
  13.     @dest_y = self.y
  14.     end
  15.    
  16.     def start(dest_x, dest_y)
  17.         @dest_x = dest_x
  18.         @dest_y = dest_y
  19.     end
  20.  
  21.     alias cms_update update
  22.     def update
  23.     super
  24.     # Reset if windowskin was changed
  25.     if $game_system.windowskin_name != @windowskin_name
  26.       @windowskin_name = $game_system.windowskin_name
  27.       self.windowskin = RPG::Cache.windowskin(@windowskin_name)
  28.     end
  29.         if self.x < @dest_x
  30.             self.x += 32
  31.         end
  32.         if self.x > @dest_x
  33.             self.x -= 32
  34.         end
  35.         if self.y < @dest_y
  36.             self.y += 32
  37.         end
  38.         if self.y > @dest_y
  39.             self.y -= 32
  40.         end
  41.     end
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement