Naughty3chia
Member
I need a link to anywhere where I can find MOG's menu scripts for VX prefferably the show map name and character status menu thing...
#==============================================================================
# ** Sprite_Command
#------------------------------------------------------------------------------
# This list of sprites act much like a command window.
#==============================================================================
class Sprite_Command
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :commands,
:index,
:openness
attr_accessor :active
#--------------------------------------------------------------------------
# * Object Initialization
# commands : command string array
# image_dir : the directory to look for the images.
# image_norm : the string suffix used to indicate the normal state.
# image_over : the string suffix used to indicate the over state.
# vertical : the boolean that if true lays out options vertically.
# spacing : the spacing between objects when horizontal.
#--------------------------------------------------------------------------
def initialize(commands, image_dir, image_norm, image_over,
vertical = true, spacing = 32)
# All the usual suspects
@commands = commands
@image_dir = image_dir
@image_norm = image_norm
@image_over = image_over
@vertical = vertical
@spacing = spacing
@flip_cursor = true
# Create the sprite array.
@sprites = []
@largest_width = 0
@largest_height = 0
# Load the graphics determine maximum width and height
for i in 0...@commands.size
@sprites << Sprite.new
@sprites[i].bitmap =
Cache.load_bitmap(@image_dir, @commands[i] + @image_norm)
@sprites[i].z = 998
@largest_width = [@sprites[i].bitmap.width, @largest_width].max
@largest_height = [@sprites[i].bitmap.height, @largest_height].max
end
half_width = @largest_width >> 1
half_height = @largest_height >> 1
@sprites.each do |sprite|
sprite.ox -= (half_width - (sprite.bitmap.width >> 1))
end
@x = @y = @z = 0
self.openness = 255
@opening = false
@closing = false
@active = true
# Set the index.
self.index = 0
update_sprite_images
move_sprites
end
#--------------------------------------------------------------------------
# * Flip Cursor - Relevent To Horizontal Placement Only
#--------------------------------------------------------------------------
def flip_cursor
@flip_cursor = !@flip_cursor
end
#--------------------------------------------------------------------------
# * Initialize Cursor
# cursor_dir : the directory where the image is located.
# cursor_images : the filename of the cursor's image.
#--------------------------------------------------------------------------
def initialize_cursor(cursor_dir, cursor_images)
# Create the sprite cursor if it doesn't exist.
@cursor = Sprite_Cursor.new(cursor_dir, cursor_images) if @cursor.nil?
# khMove it to where it should be.
move_cursor
# Make sure its visible.
@cursor.visible = true
end
#--------------------------------------------------------------------------
# * Disable Cursor
#--------------------------------------------------------------------------
def disable_cursor
@cursor.visible = false unless @cursor.nil?
end
#--------------------------------------------------------------------------
# * Update Cursor
#--------------------------------------------------------------------------
def update_cursor
# If the cursor is created and visible.
@cursor.update
@cursor.visible = !(@index < 0 || @index >= @commands.size)
end
#--------------------------------------------------------------------------
# * Move Cursor
#--------------------------------------------------------------------------
def move_cursor
if @vertical
unless @cursor.nil?
@cursor.x = @x
@cursor.y = @y + (@index * @largest_height) + (@largest_height >> 1)
@cursor.z = @z
end
else
unless @cursor.nil?
@cursor.x = @x + (@index * @largest_width) + (@index * @spacing) +
(@largest_width >> 1)
@cursor.y = @flip_cursor ? @y + @largest_height : @y
@cursor.z = @z
end
end
end
#--------------------------------------------------------------------------
# * Update Sprites Images
#--------------------------------------------------------------------------
def update_sprite_images
@sprites.each_index do |i|
@sprites[i].bitmap = @sprites[i] == @sprites[@index] ?
Cache.load_bitmap(@image_dir, @commands[i] + @image_over) :
Cache.load_bitmap(@image_dir, @commands[i] + @image_norm)
end
end
#--------------------------------------------------------------------------
# * Move Sprites
#--------------------------------------------------------------------------
def move_sprites
if @vertical
@sprites.each_index do |i|
@sprites[i].x = @x
@sprites[i].y = @y + (i * @largest_height)
@sprites[i].z = @z
end
else
@sprites.each_index do |i|
@sprites[i].x = @x + (i * @largest_width) + (i * @spacing)
@sprites[i].y = @y
@sprites[i].z = @z
end
end
move_cursor
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# To make this compatible with Window_Base code standards.
if @opening
self.openness += 48
@opening = false if @openness == 255
elsif @closing
self.openness -= 48
@closing = false if @openness == 0
end
return unless @active
# Save the current index if it changes do something.
index = @index
if @vertical
self.index -= 1 if Input.trigger?(Input::UP)
self.index += 1 if Input.trigger?(Input::DOWN)
else
self.index -= 1 if Input.trigger?(Input::LEFT)
self.index += 1 if Input.trigger?(Input::RIGHT)
end
update_cursor unless @cursor.nil?
# If the index has changed play the movement sound and update the sprites
if @index != index
Sound.play_cursor
update_sprite_images
move_cursor
end
end
#--------------------------------------------------------------------------
# * Set Cursor Position
# index : new cursor position
#--------------------------------------------------------------------------
def index=(index)
# adjust index if necessary. I want looping.
index = @commands.size - 1 if index < 0
index = 0 if index > @commands.size - 1
@index = index
update_sprite_images
end
#--------------------------------------------------------------------------
# * Get Height
#--------------------------------------------------------------------------
def height
return @vertical ? @commands.size * @largest_height : @largest_height
end
#--------------------------------------------------------------------------
# * Get Width
#--------------------------------------------------------------------------
def width
if @vertical
return @largest_width
else
return (@largest_width * @commands.size) + (@spacing * @commands.size)
end
end
#--------------------------------------------------------------------------
# * Get X
#--------------------------------------------------------------------------
def x
return @sprites[0].x + (@sprites[0].bitmap.width >> 1) -
(@largest_width >> 1)
end
#--------------------------------------------------------------------------
# * Get Y
#--------------------------------------------------------------------------
def y
return @sprites[0].y
end
#--------------------------------------------------------------------------
# * Get Z
#--------------------------------------------------------------------------
def z
return @sprites[0].z
end
#--------------------------------------------------------------------------
# * Set X Coordinate
# x : the new x coordinate
#--------------------------------------------------------------------------
def x=(x)
@x = x
move_sprites
end
#--------------------------------------------------------------------------
# * Set Y Coordinate
# y : the new y coordinate
#--------------------------------------------------------------------------
def y=(y)
@y = y
move_sprites
end
#--------------------------------------------------------------------------
# * Set Z Coordinate
# z : the new z coordinate
#--------------------------------------------------------------------------
def z=(z)
@z = z
move_sprites
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
unless @sprite.nil?
@sprite.bitmap.dispose
@sprite.dispose
end
@cursor.dispose unless @cursor.nil?
@sprites.each do |sprite|
sprite.bitmap.dispose
sprite.dispose
end
end
#--------------------------------------------------------------------------
# * Open Sesame
# openness : the new openness of the window.
#--------------------------------------------------------------------------
def openness=(openness)
@openness = [[openness, 255].min, 0].max
end
#--------------------------------------------------------------------------
# * Open Sprite Command
#--------------------------------------------------------------------------
def open
@opening = true if self.openness < 255
@closing = false
end
#--------------------------------------------------------------------------
# * Close Sprite Command
#--------------------------------------------------------------------------
def close
@closing = true if self.openness > 0
@opening = false
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs the menu screen processing.
#==============================================================================
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# * Constant Variables
#--------------------------------------------------------------------------
IMAGE_DIR = 'Graphics/Pictures/'
IMAGE_NORM = '_norm'
IMAGE_OVER = '_over'
#--------------------------------------------------------------------------
# * Create Command Window !OVERRIDE!
#--------------------------------------------------------------------------
def create_command_window
s1 = Vocab::item
s2 = Vocab::skill
s3 = Vocab::equip
s4 = Vocab::status
s5 = Vocab::save
s6 = Vocab::game_end
@command_window = Sprite_Command.new([s1, s2, s3, s4, s5, s6],
IMAGE_DIR, IMAGE_NORM, IMAGE_OVER)
@command_window.index = @menu_index
end
end