Project1
标题: 血条描绘 [打印本页]
作者: 黑米馒头 时间: 2012-8-1 21:00
标题: 血条描绘
本帖最后由 黑米馒头 于 2012-8-1 21:12 编辑
貌似发现咱的血条描绘出现了小数点,这是怎么回事? 显示成1100.0/1100 。希望大侠不吝赐教。
可以的话教下为什么会这样?
果断上脚本、- def draw_actor_hp_lvup(actor, x, y, width = 144)
- # 描绘字符串 "HP"
- self.contents.font.color = system_color
- # 描绘 HP
- self.contents.font.color = actor.hp == 0 ? knockout_color :
- actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
- self.contents.draw_text(x+20+6-7, y, 48, 32, actor.hp.to_s, 2)
- # 描绘 MaxHP
- self.contents.font.color = normal_color
- self.contents.draw_text(x+30+6-7 , y, 48, 32, "/", 2)
- if $temp_hp == 0
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 80+6-7 , y, 48, 32, actor.maxhp.to_s)
- else
- maxhp = actor.maxhp + $temp_hp
- self.contents.font.color = Color.new(255, 128, 128, 255)
- self.contents.draw_text(x + 80+6-7 , y, 48, 32, maxhp.to_s)
- self.contents.font.color = normal_color
- end
- end
复制代码