赞 | 1 |
VIP | 0 |
好人卡 | 1 |
积分 | 1 |
经验 | 5436 |
最后登录 | 2023-1-31 |
在线时间 | 585 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 68
- 在线时间
- 585 小时
- 注册时间
- 2013-5-25
- 帖子
- 1524
|
本帖最后由 RyanBern 于 2014-7-10 12:07 编辑
将原来绿色的血条色相逆时针转过90°就能变成红色
用下面这个计算式达到目的
90 *Math.sqrt( actor.hp.to_f / actor.maxhp) - 90
因为如果是用一次函数的话血条变黄太快,换了根式
增加脚本见09行- def HP(actor,x,y,w=74,width=144)
- # HP条
- #HP最大值
- @bitmap1 =Bitmap.new("Graphics/Pictures/HP")
- [email protected] *actor.hp/actor.maxhp
- @src_rect1 = Rect.new( 0, 0, w1, @bitmap1.height)
- self.contents.blt(x+119,y+11,@bitmap1,@src_rect1)
- self.contents.hue_change 90 *Math.sqrt( actor.hp.to_f / actor.maxhp) - 90
- @bitmap3 =Bitmap.new("Graphics/Pictures/MHP")
- [email protected]
- @src_rect3 = Rect.new( 0, 0, w3, @bitmap3.height)
- self.contents.blt(x+38,y-22,@bitmap3,@src_rect3)
- #HP
- hp_x = x
- flag = false
- self.contents.font.color = actor.hp == 0 ? knockout_color :
- actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
- # 描绘 MaxHP
- if flag
- self.contents.font.color =normal_color
- self.contents.draw_text(hp_x + 20, y+40, 12, 20, "/", 1)
- self.contents.draw_number(hp_x + 35, y, actor.maxhp.to_s)
- end
- end
- #SP条
- def SP(actor,x,y,w=74,width=144)
- #SP最大值
- @bitmap4 =Bitmap.new("Graphics/Pictures/MSP")
- [email protected]
- @src_rect4 = Rect.new( 0, 0, w4, @bitmap4.height)
- self.contents.blt(x+68,y,@bitmap4,@src_rect4)
- #sp
- @bitmap2 =Bitmap.new("Graphics/Pictures/SP")
- [email protected] *actor.sp/actor.maxsp
- @src_rect2 = Rect.new( 0, 0, w2, @bitmap2.height)
- self.contents.blt(x+68,y,@bitmap2,@src_rect2)
- sp_x = x
- flag = false
- # 描绘 SP
- self.contents.font.color = actor.sp == 0 ? knockout_color :
- actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
- # 描绘 MaxSP
- if flag
- self.contents.font.color = normal_color
- self.contents.draw_text(sp_x + 20, y+41, 13, 20, "/", 1)
- #把括号后的2去掉,中间的两个数字也去掉,
- self.contents.draw_number(sp_x + 35, y, actor.maxsp.to_s)
- #把draw_text改为draw_number就行了!!
- end
- end
复制代码 |
评分
-
查看全部评分
|