QQ图片20170509125027.png (115.99 KB, 下载次数: 41)
def draw_six_status(actor,x,y) line_color = Color.new(255,0,0) gauge_back_color = Color.new(255,255,255) contents.fill_rect(x-50, y-50, 100, 2, gauge_back_color) 50.times {|i|contents.fill_rect(x-50-i, y-50+i, 2, 1, gauge_back_color)} 50.times {|i|contents.fill_rect(x-100+i, y+i, 2, 1, gauge_back_color)} contents.fill_rect(x-50, y+50, 100, 2, gauge_back_color) 50.times {|i|contents.fill_rect(x+50+i, y+50-i, 2, 1, gauge_back_color)} 50.times {|i|contents.fill_rect(x+100-i, y-i, 2, 1, gauge_back_color)} actor.atk.times {|i| contents.fill_rect(x+i, y-i, 2, 1, line_color)} (actor.def*2).times {|i| contents.fill_rect(x+i, y, 2, 1, line_color)} actor.mat.times {|i| contents.fill_rect(x+i, y+i, 2, 1, line_color)} actor.mdf.times {|i| contents.fill_rect(x-i, y+i, 2, 1, line_color)} (actor.agi*2).times {|i| contents.fill_rect(x-i, y, 2, 1, line_color)} actor.luk.times {|i| contents.fill_rect(x-i, y-i, 2, 1, line_color)} draw_triangle(x,y,x+actor.atk,y-actor.atk,x+actor.def*2,y) draw_triangle(x,y,x+actor.mat,y+actor.mat,x+actor.def*2,y) draw_triangle(x-actor.mdf,y+actor.mdf,x,y,x+actor.mat,y+actor.mat) draw_triangle(x-actor.agi*2,y,x-actor.mdf,y+actor.mdf,x,y) draw_triangle(x-actor.agi*2,y,x-actor.luk,y-actor.luk,x,y) draw_triangle(x-actor.luk,y-actor.luk,x+actor.atk,y-actor.atk,x,y) end def draw_triangle(x1,y1,x2,y2,x3,y3,color=Color.new(255,0,0,255)) x=0 k1=(y2-y1)*1.0/(x2-x1) k2=(y3-y1)*1.0/(x3-x1) k3=(y3-y2)*1.0/(x3-x2) height=1 for x in x1..x2 y = (x-x1)*k1+y1 height = (x-x1)*k2+y1-y if height < 0 y+=height height = 0 - height end contents.fill_rect(x, y, 1, height, color) end for x in x2..x3 y = (x-x2)*k3+y2 height = (x-x1)*k2+y1-y if height < 0 y+=height height = 0 - height end contents.fill_rect(x, y, 1, height, color) end end
魔法丶小肉包 发表于 2017-5-9 00:39
用了个比较笨的方法....肯定是需要修改的....
def draw_six_status(actor,x,y)
line_color = Color.n ...
魔法丶小肉包 发表于 2017-5-9 00:39
用了个比较笨的方法....肯定是需要修改的....
def draw_six_status(actor,x,y)
line_color = Color.n ...
清远 发表于 2017-5-9 12:52
增加了图片
魔法丶小肉包 发表于 2017-5-9 21:39
方法需要楼主自己调用,可自由定义六边形的边长。
方法:
draw_six(actor,a,x,y,c,s)
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |