本帖最后由 yang1zhi 于 2016-2-6 15:18 编辑
在菜单界面加了个新窗口,名字叫 Window_shuzhi 。
剩下的你改吧
$game_party.actors[0].hp.to_s这是输出队伍的1号角色的HP
$game_actors[1].hp.to_s这是输出角色库1号角色的HP
角色相关:以下为某编号的角色的相关属性
生命:$game_actors[编号].hp
精神:$game_actors[编号].sp
经验:$game_actors[编号].exp
等级:$game_actors[编号].level
最大生命:$game_actors[编号].maxhp
最大精神:$game_actors[编号].maxsp
力量:$game_actors[编号].str
灵巧:$game_actors[编号].dex
速度:$game_actors[编号].agi
魔力:$game_actors[编号].int
攻击力:$game_actors[编号].atk
物理防御:$game_actors[编号].pdef
魔法防御:$game_actors[编号].mdef
回避修正:$game_actors[编号].eva
姓名:$game_actors[编号].name
职业编号:$game_actors[编号].class_id
职业名称:$game_actors[编号].class_name
武器编号:$game_actors[编号].weapon_id
防具1编号:$game_actors[编号].armor1_id
防具2编号:$game_actors[编号].armor2_id
防具3编号:$game_actors[编号].armor3_id
防具4编号:$game_actors[编号].armor4_id
#============================================================================== # ■ Window_Steps #------------------------------------------------------------------------------ # 菜单画面显示步数的窗口。 #============================================================================== class Window_shuzhi < Window_Base #-------------------------------------------------------------------------- # ● 初始化对像 #-------------------------------------------------------------------------- def initialize #窗口的大小 super(0, 0, 160, 69) #位图的宽高 self.contents = Bitmap.new(width - 32, height - 32) #刷新 refresh end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh self.contents.clear #颜色=系统颜色 self.contents.font.color = system_color #输出引号内的文字到,前面的数字可以调整坐标 self.contents.draw_text(4, 0, 120, 32, "数值") #颜色=普通颜色 self.contents.font.color = normal_color #输出变量,$game_party.steps是步数变量 #.to_s是输出文字 self.contents.draw_text(4, 0, 120, 32,$game_actors[1].hp.to_s, 2) end end class Scene_Menu def main # 生成命令窗口 s1 = $data_system.words.item s2 = $data_system.words.skill s3 = $data_system.words.equip s4 = "状态" s5 = "存档" s6 = "结束游戏" @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6]) @command_window.index = @menu_index # 同伴人数为 0 的情况下 if $game_party.actors.size == 0 # 物品、特技、装备、状态无效化 @command_window.disable_item(0) @command_window.disable_item(1) @command_window.disable_item(2) @command_window.disable_item(3) end # 禁止存档的情况下 if $game_system.save_disabled # 存档无效 @command_window.disable_item(4) end # 生成游戏时间窗口 @playtime_window = Window_PlayTime.new @playtime_window.x = 0 @playtime_window.y = 224 # 生成步数窗口 @steps_window = Window_Steps.new @steps_window.x = 0 @steps_window.y = 320 # 生成金钱窗口 @gold_window = Window_Gold.new @gold_window.x = 0 @gold_window.y = 416 # 生成状态窗口 @status_window = Window_MenuStatus.new @status_window.x = 160 @status_window.y = 0 # 生成数值窗口 @status_window = Window_shuzhi.new @status_window.x = 0 @status_window.y = 380 # 执行过渡 Graphics.transition # 主循环 loop do # 刷新游戏画面 Graphics.update # 刷新输入信息 Input.update # 刷新画面 update # 如果切换画面就中断循环 if $scene != self break end end # 准备过渡 Graphics.freeze # 释放窗口 @command_window.dispose @playtime_window.dispose @steps_window.dispose @gold_window.dispose @status_window.dispose @shuzhi_window.dispose end end
#==============================================================================
# ■ Window_Steps
#------------------------------------------------------------------------------
# 菜单画面显示步数的窗口。
#==============================================================================
class Window_shuzhi < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
#窗口的大小
super(0, 0, 160, 69)
#位图的宽高
self.contents = Bitmap.new(width - 32, height - 32)
#刷新
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
#颜色=系统颜色
self.contents.font.color = system_color
#输出引号内的文字到,前面的数字可以调整坐标
self.contents.draw_text(4, 0, 120, 32, "数值")
#颜色=普通颜色
self.contents.font.color = normal_color
#输出变量,$game_party.steps是步数变量
#.to_s是输出文字
self.contents.draw_text(4, 0, 120, 32,$game_actors[1].hp.to_s, 2)
end
end
class Scene_Menu
def main
# 生成命令窗口
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "状态"
s5 = "存档"
s6 = "结束游戏"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
@command_window.index = @menu_index
# 同伴人数为 0 的情况下
if $game_party.actors.size == 0
# 物品、特技、装备、状态无效化
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# 禁止存档的情况下
if $game_system.save_disabled
# 存档无效
@command_window.disable_item(4)
end
# 生成游戏时间窗口
@playtime_window = Window_PlayTime.new
@playtime_window.x = 0
@playtime_window.y = 224
# 生成步数窗口
@steps_window = Window_Steps.new
@steps_window.x = 0
@steps_window.y = 320
# 生成金钱窗口
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 416
# 生成状态窗口
@status_window = Window_MenuStatus.new
@status_window.x = 160
@status_window.y = 0
# 生成数值窗口
@status_window = Window_shuzhi.new
@status_window.x = 0
@status_window.y = 380
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果切换画面就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@command_window.dispose
@playtime_window.dispose
@steps_window.dispose
@gold_window.dispose
@status_window.dispose
@shuzhi_window.dispose
end
end
|