Script update WIP
CODE
#------------------------------------------------------------------------------
# * Munkis' Picture-based window cursor V 1.1
# * Made by munkis
# •”•••••••••••—
# •‘ FEATURES •‘
# •š•••••••••••
# * Replaces the default window cursor with a picture you create. Also centers
# the text in the command windows (thanks to TheLawG14)
# * ALIASES create_command_window, terminate, and update methods of Scene_Menu,
# Scene_End, and Scene_Title.
# OVERWRITES draw_item method of Window_Command.
# * V 1.0: Initial release
# * V 1.1: You can now use multiple cursor pics as individual animation cells
#------------------------------------------------------------------------------
class Command_Window_Pic_Test < Window_Base
def initialize(x,y,width,height)
super(x,y,width,height)
self.z = 0
self.opacity = 0
@anim_start = 0
# [config]
@cursor_cells = ["MenuSelectCell01","MenuSelectCell02","MenuSelectCell03"]
# @window_properties = [pic_name, window_x, window_y, window_width,
# window_height, opacity in Scene_Menu,
# opacity in Scene_end, opacity in Scene_Title]
@window_properties = [187,125,175,235,0,0,255]
# [/config]
end
def refresh(window_contents)
self.contents.clear
if @anim_start !=60
@anim_start +=1
@pick_cell = rand(2)
elsif @anim_start == 60
@anim_start = 0
end
bitmap = Cache.picture(@cursor_cells[@pick_cell])
if $scene.is_a?(Scene_Menu)
self.opacity = @window_properties[4]
rect = Rect.new(0, -(window_contents*WLH), @window_properties[2], @window_properties[3])
self.contents.blt(x-@window_properties[0], y-@window_properties[1], bitmap, rect)
elsif $scene.is_a?(Scene_End)
self.opacity = @window_properties[5]
rect = Rect.new(0, -(window_contents*WLH), @window_properties[2], @window_properties[3])
self.contents.blt(x-@window_properties[0], y-@window_properties[1], bitmap, rect)
elsif $scene.is_a?(Scene_Title)
self.opacity = @window_properties[6]
rect = Rect.new(0, -(window_contents*WLH), @window_properties[2], @window_properties[3])
self.contents.blt(x-@window_properties[0], y-@window_properties[1], bitmap, rect)
end
bitmap.dispose
end
end
class Window_Command < Window_Selectable
def draw_item(index, enabled = true)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
if $scene.is_a?(Scene_Menu) or $scene.is_a?(Scene_End) or $scene.is_a?(Scene_Title)
self.contents.draw_text(rect, @commands[index],1)
else
self.contents.draw_text(rect, @commands[index])
end
end
end
class Window_Selectable < Window_Base
alias update_picture_cursor update_cursor
def update_cursor
update_picture_cursor
self.cursor_rect.empty if $scene.is_a?(Scene_Menu) or $scene.is_a?(Scene_End) or $scene.is_a?(Scene_Title)
end
end
class Scene_Menu < Scene_Base
alias picture_create_command_window_menu create_command_window
alias picture_terminate_menu terminate
alias picture_update_menu update
def create_command_window
picture_create_command_window_menu
@command_window.opacity = 0
@pic_test = Command_Window_Pic_Test.new(@command_window.x-16,@command_window.y-17,@command_window.width+32,@command_window.height+6)
end
def terminate
picture_terminate_menu
@pic_test.dispose
end
def update
picture_update_menu
if @window_contents != @command_window.index
@window_contents = @command_window.index
end
@pic_test.refresh(@window_contents)
end
end
class Scene_End < Scene_Base
alias picture_create_command_window_end create_command_window
alias picture_terminate_end terminate
alias picture_update_end update
def create_command_window
picture_create_command_window_end
@command_window.opacity = 0
@pic_test = Command_Window_Pic_Test.new(@command_window.x-16,@command_window.y-34,@command_window.width+32,@command_window.height+6)
end
def terminate
picture_terminate_end
@pic_test.dispose
end
def update
picture_update_end
if @window_contents != @command_window.index
@window_contents = @command_window.index
end
@pic_test.refresh(@window_contents)
end
end
class Scene_Title < Scene_Base
alias picture_create_command_window_title create_command_window
alias picture_terminate_title terminate
alias picture_update_title update
def create_command_window
picture_create_command_window_title
@command_window.opacity = 0
@pic_test = Command_Window_Pic_Test.new(@command_window.x,@command_window.y,@command_window.width,@command_window.he
ight)
end
def terminate
picture_terminate_title
@pic_test.dispose unless @command_window.nil?
end
def update
picture_update_title
unless @command_window.nil?
if @window_contents != @command_window.index
@window_contents = @command_window.index
end
@pic_test.refresh(@window_contents)
end
end
end
# * Munkis' Picture-based window cursor V 1.1
# * Made by munkis
# •”•••••••••••—
# •‘ FEATURES •‘
# •š•••••••••••
# * Replaces the default window cursor with a picture you create. Also centers
# the text in the command windows (thanks to TheLawG14)
# * ALIASES create_command_window, terminate, and update methods of Scene_Menu,
# Scene_End, and Scene_Title.
# OVERWRITES draw_item method of Window_Command.
# * V 1.0: Initial release
# * V 1.1: You can now use multiple cursor pics as individual animation cells
#------------------------------------------------------------------------------
class Command_Window_Pic_Test < Window_Base
def initialize(x,y,width,height)
super(x,y,width,height)
self.z = 0
self.opacity = 0
@anim_start = 0
# [config]
@cursor_cells = ["MenuSelectCell01","MenuSelectCell02","MenuSelectCell03"]
# @window_properties = [pic_name, window_x, window_y, window_width,
# window_height, opacity in Scene_Menu,
# opacity in Scene_end, opacity in Scene_Title]
@window_properties = [187,125,175,235,0,0,255]
# [/config]
end
def refresh(window_contents)
self.contents.clear
if @anim_start !=60
@anim_start +=1
@pick_cell = rand(2)
elsif @anim_start == 60
@anim_start = 0
end
bitmap = Cache.picture(@cursor_cells[@pick_cell])
if $scene.is_a?(Scene_Menu)
self.opacity = @window_properties[4]
rect = Rect.new(0, -(window_contents*WLH), @window_properties[2], @window_properties[3])
self.contents.blt(x-@window_properties[0], y-@window_properties[1], bitmap, rect)
elsif $scene.is_a?(Scene_End)
self.opacity = @window_properties[5]
rect = Rect.new(0, -(window_contents*WLH), @window_properties[2], @window_properties[3])
self.contents.blt(x-@window_properties[0], y-@window_properties[1], bitmap, rect)
elsif $scene.is_a?(Scene_Title)
self.opacity = @window_properties[6]
rect = Rect.new(0, -(window_contents*WLH), @window_properties[2], @window_properties[3])
self.contents.blt(x-@window_properties[0], y-@window_properties[1], bitmap, rect)
end
bitmap.dispose
end
end
class Window_Command < Window_Selectable
def draw_item(index, enabled = true)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
if $scene.is_a?(Scene_Menu) or $scene.is_a?(Scene_End) or $scene.is_a?(Scene_Title)
self.contents.draw_text(rect, @commands[index],1)
else
self.contents.draw_text(rect, @commands[index])
end
end
end
class Window_Selectable < Window_Base
alias update_picture_cursor update_cursor
def update_cursor
update_picture_cursor
self.cursor_rect.empty if $scene.is_a?(Scene_Menu) or $scene.is_a?(Scene_End) or $scene.is_a?(Scene_Title)
end
end
class Scene_Menu < Scene_Base
alias picture_create_command_window_menu create_command_window
alias picture_terminate_menu terminate
alias picture_update_menu update
def create_command_window
picture_create_command_window_menu
@command_window.opacity = 0
@pic_test = Command_Window_Pic_Test.new(@command_window.x-16,@command_window.y-17,@command_window.width+32,@command_window.height+6)
end
def terminate
picture_terminate_menu
@pic_test.dispose
end
def update
picture_update_menu
if @window_contents != @command_window.index
@window_contents = @command_window.index
end
@pic_test.refresh(@window_contents)
end
end
class Scene_End < Scene_Base
alias picture_create_command_window_end create_command_window
alias picture_terminate_end terminate
alias picture_update_end update
def create_command_window
picture_create_command_window_end
@command_window.opacity = 0
@pic_test = Command_Window_Pic_Test.new(@command_window.x-16,@command_window.y-34,@command_window.width+32,@command_window.height+6)
end
def terminate
picture_terminate_end
@pic_test.dispose
end
def update
picture_update_end
if @window_contents != @command_window.index
@window_contents = @command_window.index
end
@pic_test.refresh(@window_contents)
end
end
class Scene_Title < Scene_Base
alias picture_create_command_window_title create_command_window
alias picture_terminate_title terminate
alias picture_update_title update
def create_command_window
picture_create_command_window_title
@command_window.opacity = 0
@pic_test = Command_Window_Pic_Test.new(@command_window.x,@command_window.y,@command_window.width,@command_window.he
ight)
end
def terminate
picture_terminate_title
@pic_test.dispose unless @command_window.nil?
end
def update
picture_update_title
unless @command_window.nil?
if @window_contents != @command_window.index
@window_contents = @command_window.index
end
@pic_test.refresh(@window_contents)
end
end
end
EDIT: It changes cells once per frame; I want it to wait 30 frames (although the user will be able to change this value).