这个定义的话放在window_base最后就可以了~然后在需要调用的地方调用就行,比如想在战斗中显示我方角色的血条,先前在window_base已经定义过傻瓜式描绘法的话就在window_battlestatus里的
|
路过蹭水.. 7楼的那个MS只定义了描绘血条的函数而且MS三个函数的名称都一样..就像原帖里说的应该只是提供了3个描绘血条的方法吧..要用的话要把这些放到window_base里,然后在需要用的地方调用~ |
本帖最后由 ccsgws 于 2009-9-20 00:55 编辑 今天看了论坛15页的血条帖子,收集了好多脚本。。。。。明天看横板战斗 结贴! |
6# 青龙 有好多》请问这个怎么用 原帖地址 http://rpg.blue/htm/Topic_30227.htm class Window_Base #------------------------------------------------------------------------- # 描绘血槽 (傻瓜级) #------------------------------------------------------------------------- def draw_hp_bar(x, y, min, max, width, height, bar_color = Color.new(150, 0, 0, 255) ) # 描绘背景 self.contents.fill_rect(x, y, width, height, Color.new(50, 50, 50, 255)) # 描绘血槽 self.contents.fill_rect(x + 1, y + 1, (width - 2) * (min / max.to_f), height - 2, bar_color) end #------------------------------------------------------------------------- # 描绘渐变血槽 (美观级) #------------------------------------------------------------------------- def draw_hp_bar(x, y, min, max, width = 152, height = 6, bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255)) # 描绘背景 self.contents.fill_rect(x, y, width, height, Color.new(50, 50, 50, 255)) # 描绘血槽 for i in 1..( (min / max) * width -1) r = bar_color.red * (width - i) / width + end_color.red * i / width g = bar_color.green * (width - i) / width + end_color.green * i / width b = bar_color.blue * (width - i) / width + end_color.blue * i / width a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width self.contents.fill_rect(x + 1 + i, y + 1, 1, height - 2, Color.new(r, g, b, a)) end end #------------------------------------------------------------------------- # 描绘有倾斜度渐变血槽 (进阶级) #------------------------------------------------------------------------- def draw_hp_bar(x, y, min, max, width = 152, height = 6, bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255)) #描绘边框 for i in 0..height self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255)) end # 描绘背景 for i in 1..(height - 1) r = 100 * (height - i) / height + 0 * i / height g = 100 * (height - i) / height + 0 * i / height b = 100 * (height - i) / height + 0 * i / height a = 255 * (height - i) / height + 255 * i / height self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a)) end # 描绘血槽 for i in 1..( (min / max) * width - 1) for j in 1..(height - 1) r = bar_color.red * (width - i) / width + end_color.red * i / width g = bar_color.green * (width - i) / width + end_color.green * i / width b = bar_color.blue * (width - i) / width + end_color.blue * i / width a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a)) end end end end |
站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作
GMT+8, 2024-11-25 03:21
Powered by Discuz! X3.1
© 2001-2013 Comsenz Inc.