| 赞 | 14 |
| VIP | |
| 好人卡 | |
| 积分 | 6 |
| 经验 | |
| 最后登录 | 2026-8-9 |
| 在线时间 | 797 小时 |
- 梦石
- 0
- 星屑
- 606
- 在线时间
- 797 小时
- 注册时间
- 2014-7-1
- 回帖
- 501

|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
如图 血槽采用四张图片来设定
每一张图片只计算角色25%的血量
这个公式应该怎么去计算呢!
就像一些网络游戏一样 血条有好几层一样
[pre lang="ruby"]
def draw_actor_hp1_bar(actor, x, y,height=60)
bitmap3=Bitmap.new("Graphics/Pictures/xue4")
w4 = 1.0 * actor.hp / actor.maxhp * height
src_rect3 = Rect.new(0, 0, 60,w4)
self.contents.blt(x+300, y, bitmap3, src_rect3)
bitmap2=Bitmap.new("Graphics/Pictures/xue3") # 60 60
w3 = 1.0 * actor.hp / actor.maxhp * height
src_rect2 = Rect.new(0, 0, 60,w3)
self.contents.blt(x+200, y, bitmap2, src_rect2)
bitmap1=Bitmap.new("Graphics/Pictures/xue2")
w2 = 1.0 * actor.hp / actor.maxhp * height
src_rect1 = Rect.new(0, 0, 60,w2)
self.contents.blt(x+100, y, bitmap1, src_rect1)
bitmap=Bitmap.new("Graphics/Pictures/xue1") # 60 60
w1 = 1.0 * actor.hp / actor.maxhp * height
src_rect = Rect.new(0, 0, 60,w1)
self.contents.blt(x, y, bitmap, src_rect)
end
[/pre] |
|