加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 clear仔 于 2013-7-27 21:25 编辑
想弄个在战斗中显示状态信息的东西。
先追加了类:
class Window_State < Window_Base def initialize super(160,0,480,320) self.opacity = 160 self.back_opacity = 160 self.contents = Bitmap.new(384,256) end def make_text for i in 0..$show_state_choose.index case $show_state_choose.commands[i] when "战斗不能" a = "\\C[2]名称:战斗不能" b = "效果:\\n因受重伤而不能行动,若战斗结束时仍然处于此状态,\\n将无法获得战斗经验。" else a = "aaaaaaaa" b = "bbbbbbbb" end end self.contents.draw_text(16,16,224,32,a) self.contents.draw_text(16,48,224,32,b) end end class Window_Command < Window_Selectable attr_accessor :commands end
class Window_State < Window_Base
def initialize
super(160,0,480,320)
self.opacity = 160
self.back_opacity = 160
self.contents = Bitmap.new(384,256)
end
def make_text
for i in 0..$show_state_choose.index
case $show_state_choose.commands[i]
when "战斗不能"
a = "\\C[2]名称:战斗不能"
b = "效果:\\n因受重伤而不能行动,若战斗结束时仍然处于此状态,\\n将无法获得战斗经验。"
else
a = "aaaaaaaa"
b = "bbbbbbbb"
end
end
self.contents.draw_text(16,16,224,32,a)
self.contents.draw_text(16,48,224,32,b)
end
end
class Window_Command < Window_Selectable
attr_accessor :commands
end
然后在Scene_Battle里添加了:
def state_start @window_help.visible = false if @window_help @party_command_window.active = false @party_command_window.visible = false start_actor_select if Input.trigger?(Input::C) $arrow_index = @actor_arrow.actor end_actor_select $states = ["属性"] for i in $arrow_index.states $states.push($data_states[i].name.to_s) end $show_state_choose = Window_Command.new(160,$states) $show_state_choose.opacity = 160 $show_state_choose.back_opacity = 160 $show_state_choose.active = true $show_state_choose.height = 320 @state_window = Window_State.new end end def state_do if Input.trigger?(Input::B) $show_state_choose.active = false $show_state_choose.visible = false @window_help.visible = true if @window_help @party_command_window.active = true @party_command_window.visible = true @state_window.visible = false end @state_window.make_text end
def state_start
@window_help.visible = false if @window_help
@party_command_window.active = false
@party_command_window.visible = false
start_actor_select
if Input.trigger?(Input::C)
$arrow_index = @actor_arrow.actor
end_actor_select
$states = ["属性"]
for i in $arrow_index.states
$states.push($data_states[i].name.to_s)
end
$show_state_choose = Window_Command.new(160,$states)
$show_state_choose.opacity = 160
$show_state_choose.back_opacity = 160
$show_state_choose.active = true
$show_state_choose.height = 320
@state_window = Window_State.new
end
end
def state_do
if Input.trigger?(Input::B)
$show_state_choose.active = false
$show_state_choose.visible = false
@window_help.visible = true if @window_help
@party_command_window.active = true
@party_command_window.visible = true
@state_window.visible = false
end
@state_window.make_text
end
将原来的Scene_Battle2中,方法update_phase2中,“when 1 ”的分支改为了
$game_system.se_play($data_system.decision_se) state_start
$game_system.se_play($data_system.decision_se)
state_start
又在Scene_Battle1中,update方法中,添加了
if $show_state_choose.active state_do return end
if $show_state_choose.active
state_do
return
end
这样应该就可以在摁下逃跑选项的时候选择角色,然后显示选择窗口和信息窗口,随着光标的移动而改变信息窗口的内容了。
可是,明明在生成窗口前,调用了方法start_actor_select,但是就好像跳过了一样没有用,而且按下B键应该可以返回,但是没用,
而且按C键似乎会一直生成窗口,而且光标没有闪烁效果……(反正就是有很多乱七八糟的问题)这是怎么回事?
好吧,如果不想看上面的就看范例吧,搜索“#added” 是我添加的内容。
Project3.zip
(201.01 KB, 下载次数: 28)
希望能有人解决…… |