Advertisement
DizzyFoxkit

menu with @move

May 25th, 2012
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.05 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.x
  14.         @move = false
  15.     end
  16.    
  17.     def start(dest_x, dest_y, move)
  18.         @dest_x = dest_x
  19.         @dest_y = dest_y
  20.         @move = move
  21.     end
  22.  
  23.     def update
  24.     super
  25.     # Reset if windowskin was changed
  26.     if $game_system.windowskin_name != @windowskin_name
  27.       @windowskin_name = $game_system.windowskin_name
  28.       self.windowskin = RPG::Cache.windowskin(@windowskin_name)
  29.     end
  30.         if @move == true || self.x < @dest_x
  31.             self.x += 32
  32.         end
  33.         if @move == true || self.x > @dest_x
  34.             self.x -= 32
  35.         end
  36.         if self.x == @dest_x
  37.             @move = false
  38.         end
  39.         if @move == true || self.y < @dest_y
  40.             self.y += 32
  41.         end
  42.         if @move = true || self.y > @dest_y
  43.             self.y -= 32
  44.         end
  45.         if self.x == @dest_y
  46.             @move = false
  47.         end
  48.     end
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement