Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Moving Windows
#1
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


okay, well i remembered that i did this a while back thanks to SephirothSpawn.... so i decided to realease it in case anyone wanted it...

what this is: its for making windows move, like in the menu, windows start off screen and then move into place... so you know... its really simple and stuff...

OK... well now... we have a new good scripter and he goes by the name of HonorBlade... and luckily for me he decided to upgrade this thing so now it is considered... um... well... its ALOT better than it was before... i had planned on upgrading and fixing alot of stuff in here when i got the time... well after i found it anyway.... but sadly that time never came... and luckily he did it for me... windows still move 1 at a time.. but who cares...? now they can go left and right... and up and down... okay then here it is... so everyone give some thanks to HonorBlade... plus he actually asked what he should do with it.. which is cool... cause most people wouldn't do that... anyway:



Code:
#======================================
# date = "May 13, 2005"
# remembered about and found and some stuff fixed "June 20, 2005"
#======================================
# Moving windows for menu's by: makeamidget
# still need some new stuff, like two moving windows at once...
# and support for Selectable Windows and Command Windows
#======================================
# modified by HonorBlade, June 28, 2005
# now works with all types of windows
# create a window in the usual way, then use its "move" method
#======================================
# rewritten (barely) - makeamidget- i changed some stuff in here but
# it is still HonorBlades mod..  i just took out some now useless stuff... and
# made some code look prettier
#======================================
# it's HonorBlade once again
# man these comments are getting longer than the script itself:-)
# added: move window now works in all directions
# also had to fix a few bugs
#======================================

class Window_Base < Window

def initialize(x, y, width, height)
super()
@windowskin_name = $game_system.windowskin_name
self.windowskin = RPG::Cache.windowskin(@windowskin_name)
@end_x = self.x = x
@end_y = self.y = y
@end_o = self.opacity
@move_enabled = false
self.width = width
self.height = height
self.z = 100
end

def move(end_x=0, end_y=0, end_o =255)
@end_x = end_x
@end_y = end_y
@end_o = end_o
@move_enabled = true
end

def update_position
Graphics.update
if self.x < @end_x
if self.x + 20 < @end_x
self.x += 20
else
self.x = @end_x
end
end
if self.x > @end_x
if self.x - 20 > @end_x
self.x -= 20
else
self.x = @end_x
end
end
if self.y < @end_y
if self.y + 20 < @end_y
self.y += 20
else
self.y = @end_y
end
end
if self.y > @end_y
if self.y - 20 > @end_y
self.y -= 20
else
self.y = @end_y
end
end
if self.opacity.to_i < @end_o
if self.opacity + 20 < @end_o
self.opacity += 20
else
self.opacity = @end_o
end    
end
if self.opacity.to_i > @end_o
if self.opacity - 20 > @end_o
self.opacity -= 20
else
self.opacity = @end_o
end    
end

update
end

def update
super
if $game_system.windowskin_name != @windowskin_name
   @windowskin_name = $game_system.windowskin_name
   self.windowskin = RPG::Cache.windowskin(@windowskin_name)
end
if @move_enabled
if self.x != @end_x or self.y != @end_y or self.opacity != @end_o
   update_position
else
   @move_enabled = false
end
end
end

def finished?
if self.x == @end_x and self.y == @end_y
  return true
else
  return false
end
end

end

now all you do is create a window like normal and just use the move method to move it... the move method is fed the end x end y and end opacity.. in that order... so if you wanted to change the y only you would have to feed it an x value... for opacity you would feed x and y...

so Ex:

Code:
@playtime_window = Window_PlayTime.new
    @playtime_window.x = 0
    @playtime_window.y = 224
    @playtime_window.move(200, 100, 88)

it would move the playtime window from "0, 224" to "200, 100" and change the opacity to 88...
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Advanced Command Windows Tsunokiette 0 2,365 07-07-2006, 01:00 PM
Last Post: Tsunokiette
  Horizontal Command Windows SephirothSpawn 0 2,350 11-04-2005, 01:00 PM
Last Post: SephirothSpawn



Users browsing this thread: