设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 4106|回复: 2
打印 上一主题 下一主题

[已经解决] 自制血条

[复制链接]

Lv3.寻梦者

梦石
0
星屑
2914
在线时间
387 小时
注册时间
2010-12-4
帖子
141
跳转到指定楼层
1
发表于 2021-7-6 17:34:02 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
因为不明原因直接导入图片血条后进入战斗后发生剧情对话会出现严重的顿卡,所以自己用脚本做了一个渐变颜色的血条。



可是问题又来了,如图我方血条扣血想要从右向左开始扣除的,但不知道为什么现在是从左往右开始扣除,研究了2天了,一直没有找到解决办法,求大神帮忙看看如何修改,敌人方是正常的。
下面是脚本,麻烦看下要修改哪里。

##==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================

# ————————————————————————————————————

# ▼▲▼ XRXS_BP 2. HP,SPメーター表示 ▼▲▼
# by 桜雅 在土

#==============================================================================
# ■ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化
  #--------------------------------------------------------------------------
  alias xrxs_bp2_refresh refresh
  def refresh
    xrxs_bp2_refresh
    @item_max = $game_party.actors.size
    #
    for i in 0...$game_party.actors.size
      actor = $game_party.actors
      actor_x = 0
      actor_y = i * 50 + 75
      draw_actor_hp_meter(actor, actor_x, actor_y, 100)      
    end
  end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # ● HP描画
  #--------------------------------------------------------------------------
  def draw_actor_hp_meter(actor, x, y, width = 100, type = 0)
    if type == 1 and actor.hp == 0
      return
    end
    self.contents.font.color = system_color
    self.contents.fill_rect(x-1, y+26, width,9, Color.new(0, 0, 0, 255))
    w = width * (actor.maxhp - actor.hp) / [actor.maxhp,1].max
    self.contents.fill_rect(x, y+26, 100,9, Color.new(0, 0, 0, 255))
    self.contents.fill_rect(x, y+27, 100,7, Color.new(255, 255, 0, 255))
    self.contents.fill_rect(x, y+27, 85,7, Color.new(255, 240, 0, 255))
    self.contents.fill_rect(x, y+27, 80,7, Color.new(255, 225, 0, 255))
    self.contents.fill_rect(x, y+27, 75,7, Color.new(255, 210, 0, 255))
    self.contents.fill_rect(x, y+27, 70,7, Color.new(255, 195, 0, 255))
    self.contents.fill_rect(x, y+27, 65,7, Color.new(255, 180, 0, 255))
    self.contents.fill_rect(x, y+27, 60,7, Color.new(255, 165, 0, 255))
    self.contents.fill_rect(x, y+27, 55,7, Color.new(255, 150, 0, 255))
    self.contents.fill_rect(x, y+27, 50,7, Color.new(255, 135, 0, 255))
    self.contents.fill_rect(x, y+27, 45,7, Color.new(255, 120, 0, 255))
    self.contents.fill_rect(x, y+27, 40,7, Color.new(255, 105, 0, 255))
    self.contents.fill_rect(x, y+27, 35,7, Color.new(255, 90, 0, 255))
    self.contents.fill_rect(x, y+27, 30,7, Color.new(255, 75, 0, 255))
    self.contents.fill_rect(x, y+27, 25,7, Color.new(255, 60, 0, 255))
    self.contents.fill_rect(x, y+27, 20,7, Color.new(255, 45, 0, 255))
    self.contents.fill_rect(x, y+27, 15,7, Color.new(255, 0, 0, 255))
    self.contents.fill_rect(x, y+26, w,9, Color.new(0, 0, 0, 255))

#    self.contents.fill_rect(x-2, y+26, width,9, Color.new(0, 0, 0, 255))
#    w = width * actor.hp / [actor.maxhp,1].max
#   bitmap = RPG::Cache.picture("hp1_bar")
#   self.contents.blt(x-1,y+26,bitmap,Rect.new(0,0,w,9))
  end
end

Lv4.逐梦者

梦石
0
星屑
6483
在线时间
119 小时
注册时间
2020-1-8
帖子
234
2
发表于 2021-7-6 18:42:25 | 只看该作者
1、卡顿问题
  就算新开的工程,战斗时出现消息窗口也会FPS骤降
  Scene_Battle 1里,找到这里修改
        # 如果不是结束战斗回合的情况下
        if @phase != 5
          # 刷新状态窗口
          @status_window.refresh unless $game_temp.message_window_showing
        end

2、血条位置问题
  def draw_actor_hp_meter
    最后一个self.contents.fill_rect(x, y+26, w,9, Color.new(0, 0, 0, 255))分类讨论一下fill_rect的起始x
   if Game_Actor === actor
     self.contents.fill_rect(x + width - w, y+26, w,9, Color.new(0, 0, 0, 255))
   else
     self.contents.fill_rect(x, y+26, w,9, Color.new(0, 0, 0, 255))
   end
   还是用图片写起来简单点,如你注释掉的

     

评分

参与人数 1星屑 +50 收起 理由
RyanBern + 50 认可答案

查看全部评分

回复 支持 1 反对 0

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2914
在线时间
387 小时
注册时间
2010-12-4
帖子
141
3
 楼主| 发表于 2021-7-6 20:10:20 | 只看该作者
本帖最后由 letppigogo 于 2021-7-6 20:11 编辑
RPGzh500223 发表于 2021-7-6 18:42
1、卡顿问题
  就算新开的工程,战斗时出现消息窗口也会FPS骤降
  Scene_Battle 1里,找到这里修改


现在还在加班,回家试下看看。以前用的是最简单的左右各一条红杠,一点问题都没有,月初换了血条脚本,看着华丽了,特殊战斗开始后剧情部分就悲剧了,卡的都快出翔了。排查了2晚才找到原来是血条脚本的问题。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-3 07:49

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表