Project1
标题: hp和sp都被挡住了 [打印本页]
作者: 825300455 时间: 2012-8-2 22:19
标题: hp和sp都被挡住了
本帖最后由 825300455 于 2012-8-2 22:20 编辑
我做了个hp、sp血槽,但hp,sp数值被挡了,我想显示在血槽前面怎么办,这是我想的[attach]124678[/attach]脚本在这里,要在哪加,我只要原处改和加,又要新添加一页的脚本我不要。- #==============================================================================
- # ■ Window_BattleStatus
- #------------------------------------------------------------------------------
- # 显示战斗画面同伴状态的窗口。
- #==============================================================================
- class Window_BattleStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(0, 320, 640, 160)
- self.contents = Bitmap.new(width - 32, height - 32)
- @level_up_flags = [false, false, false, false]
- refresh
- end
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- super
- end
-
- #--------------------------------------------------------------------------
- # ● 设置升级标志
- # actor_index : 角色索引
- #--------------------------------------------------------------------------
- def level_up(actor_index)
- @level_up_flags[actor_index] = true
- end
-
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- @item_max = $game_party.actors.size
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- actor_x = i * 160 + 4
- self.contents.clear
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- actor_x = i * 160 + 4
- draw_actor_name(actor, actor_x, 0)
- draw_actor_hp(actor, actor_x, 32, 120)
- draw_actor_sp(actor, actor_x, 32, 120)
- # 处理HPBar
- hpwidth = 150 * actor.hp / actor.maxhp
- per = actor.hp.to_f / actor.maxhp.to_f
- if per < 0.3
- color = Color.new(255,0,0,150)
- else
- color = Color.new(255,100,100,150)
- end
- self.contents.fill_rect(actor_x,36,150,20,Color.new(11,11,11,150))
- self.contents.fill_rect(actor_x,40,hpwidth,10,color)
- # 处理SPBar
- spwidth = 150 * actor.sp / actor.maxsp
- self.contents.fill_rect(actor_x,76,150,20,Color.new(11,11,11,150))
- self.contents.fill_rect(actor_x,80,spwidth,10, Color.new(0,0,255,150))
- if @level_up_flags[i]
- self.contents.font.color = normal_color
- self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
- else
- draw_actor_state(actor, actor_x, 96)
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- super
- # 主界面的不透明度下降
- if $game_temp.battle_main_phase
- self.contents_opacity -= 4 if self.contents_opacity > 191
- else
- self.contents_opacity += 4 if self.contents_opacity < 255
- end
- end
复制代码