| 赞 | 189 |
| VIP | |
| 好人卡 | |
| 积分 | 96 |
| 经验 | |
| 最后登录 | 2026-5-4 |
| 在线时间 | 5074 小时 |
- 梦石
- 0
- 星屑
- 9557
- 在线时间
- 5074 小时
- 注册时间
- 2013-6-21
- 回帖
- 3459
  
|
发表于 2015-8-18 11:06:33
|
显示全部楼层
同一张位图中,没有z值这个说法,z值是Sprite,Window等对象才有的属性,不是Bitmap的属性。
如果在同一张Bitmap里面修改遮挡效果,改变一下绘制顺序即可,记住一个原则:后绘制的会覆盖先绘制的。
因此,脚本修改如下:
[pre lang="Ruby"]def draw_actor_hp(actor, x, y, width = 144)
bitmap2 = RPG::Cache.icon("HP空槽")
self.contents.blt(x, y, bitmap2, Rect.new(0, 0, bitmap2.width, bitmap2.height))
bitmap = RPG::Cache.icon("hp条")
width = bitmap.width * actor.hp * 100 / actor.maxhp / 100
self.contents.blt(x + 44, y + 2, bitmap, Rect.new(0, 0, width, bitmap.height))
self.contents.font.size = 15
self.contents.font.bold = true
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
cx = contents.text_size(actor.hp.to_s).width
self.contents.draw_text(x + 85, y-7, cx, 32, actor.hp.to_s)
self.contents.font.color = normal_color
txt = "/" + actor.maxhp.to_s
self.contents.draw_text(x + 85 + cx, y-7, 126, 32, txt)
end
[/pre] |
|