class Scene_Menu
def initialize(menu_index = 0)
@menu_index = menu_index
end
def main
make_menu_window
@spriteset = Spriteset_Map.new
@menu_window.index = @menu_index
@animation_window = Window_Animation.new
@info_window = Window_Info.new
Graphics.transition
loop do
Input.update
Graphics.update
update
if $scene != self
break
end
end
Graphics.freeze
@menu_window.dispose
@animation_window.dispose
@info_window.dispose
@spriteset.dispose
end
def update
@animation_window.refresh
@menu_window.update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
end
if Input.trigger?(Input::C)
case @menu_window.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
when 1
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
end
end
end
def make_menu_window
s1 = "Items"
s2 = "End Game"
@commands = [s1,s2]
@menu_window = Window_Command.new(160,@commands)
@menu_window.active = true
end
end
class Window_Animation < Window_Base
def initialize
super(160,0,480,480)
self.contents = Bitmap.new(width - 32, height - 32)
@frame = 0
@frames = 0
@frame_count = Graphics.frame_count
@frame_width = 0
@frame_height = 0
refresh
end
def refresh
self.contents.clear
for i in 0...$game_party.actors.size
@actor = $game_party.actors[i]
@bitmap = RPG::Cache.character(@actor.character_name, @actor.character_hue)
x = 0
y = 112* i + 5
unless @actor == nil
get_settings
time = Graphics.frame_count - @frame_count
if time >= 10
@frame_count = Graphics.frame_count
rx = (@frame%4)*@frame_width
rect = Rect.new(rx,0,@frame_width,@frame_height)
self.contents.blt(x,y,@bitmap,rect,255)
@frame += 1
if @frame == @frames
@frame = 0
end
else
rx = (@frame%4)*@frame_width
ry = (@frame)%4*@frame_height
rect = Rect.new(rx,0,@frame_width,@frame_height)
self.contents.blt(x,y,@bitmap,rect,255)
end
end
end
end
def get_settings
@frame_height = @bitmap.height/4
@frame_width = @bitmap.width/4
@frames = (@bitmap.height/@frame_height)*(@bitmap.width/@frame_width)
end
end
class Window_Info < Window_Base
def initialize
super(160,0,480,480)
self.back_opacity = 0
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
for i in 0...$game_party.actors.size
self.contents.font.color = system_color
self.contents.draw_text(50,110*i + 32,100,32,"HP: ")
self.contents.font.color = normal_color
actor = $game_party.actors[i]
self.contents.draw_text(50,110*i,100,32,actor.name)
self.contents.draw_text(100,110*i + 32,500,32,actor.hp.to_s + "/" +
actor.maxhp.to_s)
end
end
end
class Scene_End
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update command window
@command_window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(1)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # to title
command_to_title
when 1 # shutdown
command_shutdown
when 2 # quit
command_cancel
end
return
end
end
#--------------------------------------------------------------------------
# * Process When Choosing [Cancel] Command
#--------------------------------------------------------------------------
def command_cancel
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to menu screen
$scene = Scene_Menu.new(1)
end
end