本帖最后由 夏季冰川 于 2010-8-9 13:43 编辑
- class Window_Help < Window_Base
- def set_enemy(actor)
- self.contents.clear
- self.contents.font.size = 15
- draw_actor_name(actor, 4, -5)
- draw_actor_state(actor, 140, -5)
- draw_slant_bar(actor, 260, -5)
- draw_mana_bar(actor, 420, -5)
- @text = nil
- self.visible = true
- end
- def draw_slant_bar(actor, x, y, width = 140)
- self.contents.font.color = normal_color
- self.contents.font.size = 18
- self.contents.fill_rect(x-1, y+3, width+2,22, Color.new(0, 0, 0, 255))
- w = width * actor.hp / actor.maxhp
- case w
- when 43..140
- self.contents.fill_rect(x, y+5, w,20, Color.new(0, 255, 0, 255))
- self.contents.fill_rect(x, y+6, w,16, Color.new(30, 255, 30, 255))
- self.contents.fill_rect(x, y+8, w,12, Color.new(60, 255, 60, 255))
- self.contents.fill_rect(x, y+10, w,8, Color.new(90, 255, 90, 255))
- self.contents.fill_rect(x, y+12, w,4, Color.new(120, 255, 120, 255))
- self.contents.fill_rect(x, y+12.5, w,2, Color.new(150, 255, 150, 255))
- when 15..42
- self.contents.fill_rect(x, y+5, w,20, Color.new(255, 255, 0, 255))
- self.contents.fill_rect(x, y+6, w,16, Color.new(255, 255, 30, 255))
- self.contents.fill_rect(x, y+8, w,12, Color.new(255, 255, 60, 255))
- self.contents.fill_rect(x, y+10, w,8, Color.new(255, 255, 90, 255))
- self.contents.fill_rect(x, y+12, w,4, Color.new(255, 255, 120, 255))
- self.contents.fill_rect(x, y+12.5, w,2, Color.new(255, 255, 150, 255))
- when 0..14
- self.contents.fill_rect(x, y+5, w,20, Color.new(255, 0, 0, 255))
- self.contents.fill_rect(x, y+6, w,16, Color.new(255, 30, 30, 255))
- self.contents.fill_rect(x, y+8, w,12, Color.new(255, 60, 60, 255))
- self.contents.fill_rect(x, y+10, w,8, Color.new(255, 90, 90, 255))
- self.contents.fill_rect(x, y+12, w,4, Color.new(255, 120, 120, 255))
- self.contents.fill_rect(x, y+12.5, w,2, Color.new(255, 150, 150, 255))
- end
- self.contents.draw_text(x + 35, y-2, 32, 32, actor.hp.to_s, 2)
- self.contents.draw_text(x + 68, y-2, 5, 32, "/", 1)
- self.contents.draw_text(x + 72, y-2, 32, 32, actor.maxhp.to_s)
- self.contents.font.color = normal_color
- end
- def draw_mana_bar(actor, x, y, width = 140)
- self.contents.font.color = normal_color
- self.contents.font.size = 18
- self.contents.fill_rect(x-1, y+3, width+2,22, Color.new(0, 0, 0, 255))
- w = width * actor.sp / actor.maxsp
- self.contents.fill_rect(x, y+5, w,20, Color.new(0, 85, 255, 255))
- self.contents.fill_rect(x, y+6, w,16, Color.new(30, 85, 255, 255))
- self.contents.fill_rect(x, y+8, w,12, Color.new(60, 85, 255, 255))
- self.contents.fill_rect(x, y+10, w,8, Color.new(90, 85, 255, 255))
- self.contents.fill_rect(x, y+12, w,4, Color.new(120, 85, 255, 255))
- self.contents.fill_rect(x, y+12.5, w,2, Color.new(150, 85, 255, 255))
- self.contents.draw_text(x + 35, y-2, 32, 32, actor.sp.to_s, 2)
- self.contents.draw_text(x + 68, y-2, 5, 32, "/", 1)
- self.contents.draw_text(x + 72, y-2, 32, 32, actor.maxsp.to_s)
- self.contents.font.color = normal_color
- end
- end
复制代码 这个行吗,老早的时候自己写的.....
效果:
|