赞 | 68 |
VIP | 0 |
好人卡 | 0 |
积分 | 65 |
经验 | 0 |
最后登录 | 2023-7-2 |
在线时间 | 119 小时 |
Lv4.逐梦者
- 梦石
- 0
- 星屑
- 6483
- 在线时间
- 119 小时
- 注册时间
- 2020-1-8
- 帖子
- 234
|
脚本绘制的图……还是用其他软件画出来的好看
横截线无论blt还是sprite.src_rect 动态环形血条 估计都不算卡
脚本是纯脚本绘制环形血条(感谢8楼,没试真不知道,真的不卡)
横截线就是简单 注释的那部分就实现了
- class Window_BattleStates < Window_Base
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- @item_max = $game_party.actors.size
- 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, 64, 120)
-
- #参数
- c1, c2 = Color.new(255, 0, 0), Color.new(0, 0, 255)
- out_r, in_r = 50, 40
- cx, cy = actor_x + 70, 64
- #高度版
- =begin
- #hp
- hpy = cy + out_r - 2 * out_r * actor.hp / actor.maxhp
- hpy.upto(cy + out_r) {|y|
- x1 = cx - Math.sqrt(out_r ** 2 - [(y - cy).abs, out_r].min ** 2)
- x2 = cx - Math.sqrt(in_r ** 2 - [(y - cy).abs, in_r].min ** 2)
- self.contents.fill_rect(x1.round, y, (x1 - x2).abs.round, 1, c1)
- }
- #sp
- spy = cy + out_r - 2 * out_r * actor.sp / actor.maxsp
- spy.upto(cy + out_r) {|y|
- x1 = cx + Math.sqrt(out_r ** 2 - [(y - cy).abs, out_r].min ** 2)
- x2 = cx + Math.sqrt(in_r ** 2 - [(y - cy).abs, in_r].min ** 2)
- w = (x1 - x2).abs.round
- self.contents.fill_rect(x2.round, y, w, 1, c2)
- }
- =end
- #角度版
- #hp
- rad = Math::PI * (270 - actor.hp * 180.0 / actor.maxhp) / 180
- yy, line_x = nil,{}
- in_r.upto(out_r) {|r|
- x = (cx + r * Math.cos(rad)).round
- y = (cy - r * Math.sin(rad)).round
- if yy != y
- line_x[y] = x
- yy = y
- end
- }
- out_y = (cy - out_r * Math.sin(rad)).round
- in_y = (cy - in_r * Math.sin(rad)).round
- [out_y, in_y].min.upto(cy + out_r) {|y|
- x1 = cx - Math.sqrt(out_r ** 2 - [(y - cy).abs, out_r].min ** 2)
- x2 = cx - Math.sqrt(in_r ** 2 - [(y - cy).abs, in_r].min ** 2)
- if (lx = line_x[y]) != nil
- w = out_y <= in_y ? (x1 - lx).abs : (lx - x2).abs
- else
- w = (x1 - x2).abs
- end
- sx = out_y <= in_y ? x1.round : x2.round - w
- self.contents.fill_rect(sx, y, w, 1, c1)
- }
- #sp
- rad = Math::PI * (270 + actor.sp * 180.0 / actor.maxsp) / 180
- yy, line_x = nil,{}
- in_r.upto(out_r) {|r|
- x = (cx + r * Math.cos(rad)).round
- y = (cy - r * Math.sin(rad)).round
- if yy != y
- line_x[y] = x
- yy = y
- end
- }
- out_y = (cy - out_r * Math.sin(rad)).round
- in_y = (cy - in_r * Math.sin(rad)).round
- [out_y, in_y].min.upto(cy + out_r) {|y|
- x1 = cx + Math.sqrt(out_r ** 2 - [(y - cy).abs, out_r].min ** 2)
- x2 = cx + Math.sqrt(in_r ** 2 - [(y - cy).abs, in_r].min ** 2)
- if (lx = line_x[y]) != nil
- w = out_y <= in_y ? (x1 - lx).abs : (lx - x2).abs
- else
- w = (x1 - x2).abs
- end
- sx = out_y <= in_y ? x1.round - w : x2
- self.contents.fill_rect(sx, y, w, 1, c2)
- }
-
- 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
复制代码 |
|