Code:
#-----------------------------------------------------------------
# Slipknot Castlevania Menu System
# created by Slipknot
# only work for one actor (like a normal Castlevania game)
#-----------------------------------------------------------------
class Scene_Menu #to not use my Menu change class Scene_Menu for class Scene_Menu2
#-----------------------------------------------------------------
def initialize (menu_index = 0)
@menu_index = menu_index
end
#-----------------------------------------------------------------
def main
@lines = Lines.new
@status = Status.new
@status.y = 16
@status.x = 22
@level = Level.new
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "" #for the moment nothing
s5 = "Save"
s6 = "Exit"
@command = Window_Command.new (192, [s1,s2,s3,s4,s5,s6])
@command.back_opacity = 175
@command.index = @menu_index
@command.y = 480 - 16 - @command.height
@command.x = 16
if $game_party.actors.size == 0
@command.disable_item (0)
@command.disable_item (1)
@command.disable_item (2)
@command.disable_item (3)
end
if $game_system.save_disabled
@command.disable_item(4)
end
@imagen = Sprite.new
@imagen.bitmap=RPG::Cache.picture("") #"richter2") #Change it if you want
@imagen.x = 640 - 16 - @imagen.bitmap.width
@imagen.y = 16
gtx = @command.width + 32
gty = @command.y
@goldtime = Goldtime.new(gtx,gty)
@help = Help.new
@help.y = 480 - @help.height - 16
@help.x = 640 - @help.width - 16
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command.dispose
@imagen.dispose
@status.dispose
@level.dispose
@goldtime.dispose
@help.dispose
@lines.dispose
end
#-----------------------------------------------------------------
def update
@status.update
@lines.update
@imagen.update
@goldtime.update
@command.update
@help.update
if @command.active
update_command
update_help
return
end
end
#-----------------------------------------------------------------
def update_help #The help change it if you want
case @command.index
when 0
@help.refresh("See the items.")
when 1
@help.refresh("See the Richter's skills.")
when 2
@help.refresh("See or change the equipment.")
when 3
@help.refresh("Sorry is empty.")
when 4
@help.refresh("Save the game for play later.")
when 5
@help.refresh("Restart or close the game.")
end
end
#-----------------------------------------------------------------
def update_command
if Input.trigger?(Input::B)
$game_system.se_play ($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
if $game_party.actors.size == 0 and @command.index < 4
$game_system.se_play ($data_system.buzzer_se)
return
end
case @command.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_Skill.new(0,1)
when 2
$game_system.se_play ($data_system.decision_se)
$scene = Scene_Equip.new(0,2)
when 3
$game_system.se_play ($data_system.decision_se)
when 4
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Save.new
when 5
$game_system.se_play ($data_system.decision_se)
$scene = Scene_End.new
end
return
end
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Status < Window_Base
#-----------------------------------------------------------------
def initialize
super (0,0,466,208)
#self.back_opacity = 175
self.opacity = 0
self.contents = Bitmap.new (width - 32, height - 32)
#self.contents.font.name = $defaultfonttype
#self.contents.font.size = $defaultfontsize
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
draw_actor_name (actor, 0,0)
draw_actor_state (actor, 230,0)
self.contents.fill_rect(0,32,418,4,system_color)
draw_actor_exp (actor, 0,36)
draw_actor_hp (actor, 230, 36)
draw_actor_sp (actor, 0, 60)
draw_actor_parameter(actor, 230, 60, 0)
draw_actor_parameter(actor, 0, 84, 1)
draw_actor_parameter(actor, 230, 84, 2)
draw_actor_parameter(actor, 0, 108, 3)
draw_actor_parameter(actor, 230, 108, 4)
draw_actor_parameter(actor, 0, 132, 5)
draw_actor_parameter(actor, 230,132, 6)
end
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Level < Window_Base
#-----------------------------------------------------------------
def initialize
super(488,144,152,64)
self.opacity = 0
self.contents = Bitmap.new (width - 32, height - 32)
#self.contents.font.name = $defaultfonttype
self.contents.font.size = 28
actor = $game_party.actors[0]
self.contents.font.color = system_color
self.contents.draw_text(0,0,48,32, "Level")
self.contents.font.color = normal_color
self.contents.draw_text(48,0,36,32, actor.level.to_s, 2)
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Scene_End
#-----------------------------------------------------------------
def command_cancel
$game_system.se_play($data_system.decision_se)
$scene = Scene_Menu.new
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Scene_Save < Scene_File
#-----------------------------------------------------------------
def on_cancel
$game_system.se_play($data_system.cancel_se)
if $game_temp.save_calling
$game_temp.save_calling = false
$scene = Scene_Map.new
return
end
$scene = Scene_Menu.new
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Goldtime < Window_Base
#-----------------------------------------------------------------
def initialize(x,y)
super(x,y,264,96)
self.back_opacity = 175
self.opacity = 0
self.contents = Bitmap.new (width - 32, height - 32)
#self.contents.font.size = $defaultfontsize
#self.contents.font.name = $defaultfonttype
refresh
end
#-----------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text (4,0,105,28, "Elapsed Time")
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec /60 % 60
sec = @total_sec % 60
text = sprintf ("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text (105,0,85,28,text, 2)
gold = $game_party.gold.to_s
unless gold.size > 4
money = gold
else
case gold.size
when 5
ary = gold.slice!(0,2)
money = ary + ","+ gold
when 6
ary = gold.slice!(0,3)
money = ary + ","+ gold
when 7
ary1 = gold.slice!(0,4)
ary2 = ary1.slice!(1,4)
money = ary1 + ","+ ary2 +","+ gold
end
end
cx = contents.text_size ($data_system.words.gold).width
self.contents.font.color = normal_color
self.contents.draw_text (0,32,186-cx,28,money.to_s,2)
self.contents.font.color = system_color
self.contents.draw_text (192-cx,32,cx,28, $data_system.words.gold,2)
end
#-----------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Help < Window_Base
#-----------------------------------------------------------------
def initialize
super(0,0,400,112)
self.back_opacity = 175
self.contents = Bitmap.new (width - 32, height - 32)
#self.contents.font.size = $defaultfontsize
#self.contents.font.name = $defaultfonttype
refresh("")
end
#-----------------------------------------------------------------
def refresh(text)
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0,4,368,32,text)
self.contents.draw_text(0,36,368,32,"Close the menu with the B button.")
end
#-----------------------------------------------------------------
end
#-----------------------------------------------------------------
class Lines < Window_Base
#-----------------------------------------------------------------
def initialize
super(0,0,640,480)
self.opacity = 0
self.contents = Bitmap.new (width - 32, height - 32)
self.contents.clear
self.contents.fill_rect(0,0,468,4,system_color)
self.contents.fill_rect(0,0,4,200,system_color)
self.contents.fill_rect(0,200,208,4,system_color)
self.contents.fill_rect(208,200,4,116,system_color)
self.contents.fill_rect(208,312,400,4,system_color)
self.contents.fill_rect(604,146,4,168,system_color)
end
#-----------------------------------------------------------------
end