- 注册时间
- 2006-4-20
- 最后登录
- 2007-10-15
超级版主
传说中的Bunny火神~!
 
- 积分
- 1
|
发表于 2006-10-22 12:26:07
|
显示全部楼层
当时的人物跟随脚本因论坛代码的关系导致出错(隐藏了某字符),现在问题已经被修正。
主角血条脚本完全可以从敌人血条那里举一反三,敌人血条的修改位置是在Window_Help,而角色血条位置是在Window_BattleStatus。
以下是代码,要放在哪里和怎么使用要自己想,全都说了就没东西学了。- ###########################################################################
- # 画敌人HP条
- # 设计by盗帅冬瓜,颜色渐变法by樱雅在土(没这个就很难画出渐变色)
- ###########################################################################
- def draw_hp_barforenemy(actor,x,y)
- width = 128
- black = Color.new(0,0,0,200)
- black2 = Color.new(0,0,0,100)
- #RP颜色计算法
- val = 255 * ((actor.hp*100)/actor.maxhp)
- green = 0 + val/100
- val2 = 255 * ((actor.hp*100)/actor.maxhp)
- red2 = 255 - val2/100
- green2 = 0 + val2/100
- startcolor = Color.new(red2,green2,0,200)
- endcolor = Color.new(255,green,0,200)
- w = width * actor.hp / actor.maxhp
- #黑色倒影
- draw_line(x+4, y+18, x+width+4, y+18, black, 7, black2)
- #画血条(横板渐变色,颜色变化法由樱雅在土提供)
- draw_line(x, y+14, x+w, y+14, startcolor, 7, endcolor)
- #写上HP两个大字
- self.contents.font.color = Color.new(0, 0, 0, 150)
- self.contents.draw_text(x,y,142,36,$data_system.words.hp,1)
- self.contents.font.color = Color.new(255, 255, 255, 255)
- self.contents.draw_text(x,y,138,32,$data_system.words.hp,1)
- end
- ###########################################################################
- # 画敌人SP条
- # 设计by盗帅冬瓜,颜色渐变法by樱雅在土(没这个就很难画出渐变色)
- ###########################################################################
- def draw_sp_barforenemy(actor,x,y)
- width = 128
- black = Color.new(0,0,0,200)
- black2 = Color.new(0,0,0,100)
- startcolor = Color.new(0,0,255,200)
- endcolor = Color.new(0,255,255,200)
- w = width * actor.sp / actor.maxsp
- #黑色倒影
- draw_line(x+4, y+18, x+width+4, y+18, black, 7, black2)
- #画气条(横板渐变色,颜色变化法由樱雅在土提供)
- draw_line(x, y+14, x+w, y+14, startcolor, 7, endcolor)
- #写上SP两个大字
- self.contents.font.color = Color.new(0, 0, 0, 150)
- self.contents.draw_text(x,y,142,36,$data_system.words.sp,1)
- self.contents.font.color = Color.new(255, 255, 255, 255)
- self.contents.draw_text(x,y,138,32,$data_system.words.sp,1)
- end
- ###########################################################################
- # 画我方HP条
- # 设计by盗帅冬瓜,颜色渐变法by樱雅在土(没这个就很难画出渐变色)
- ###########################################################################
- def draw_hp_barforactor(actor,x,y)
- width = 108
- black = Color.new(0,0,0,200)
- black2 = Color.new(0,0,0,100)
- #RP颜色计算法
- val = 255 * ((actor.hp*100)/actor.maxhp)
- green = 0 + val/100
- val2 = 255 * ((actor.hp*100)/actor.maxhp)
- red2 = 255 - val2/100
- green2 = 0 + val2/100
- startcolor = Color.new(red2,green2,0,150)
- endcolor = Color.new(255,green,0,150)
- w = width * actor.hp / actor.maxhp
- #黑色倒影
- draw_line(x+4, y+18, x+width+4, y+18, black, 7, black2)
- #画血条(横板渐变色,颜色变化法由樱雅在土提供)
- draw_line(x, y+14, x+w, y+14, startcolor, 7, endcolor)
- #写上HP两个大字,顺便表示HP的数值。
- self.contents.font.size = 20
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
- self.contents.font.color = actor.hp == 0 ? knockout_color :
- actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
- self.contents.draw_text(x, y, 68, 32, actor.hp.to_s, 2)
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 68, y, 12, 32, "/", 1)
- self.contents.draw_text(x + 80, y, 48, 32, actor.maxhp.to_s)
- self.contents.font.size = 22
- end
- ###########################################################################
- # 画我方SP条
- # 设计by盗帅冬瓜,颜色渐变法by樱雅在土(没这个就很难画出渐变色)
- ###########################################################################
- def draw_sp_barforactor(actor,x,y)
- width = 108
- black = Color.new(0,0,0,200)
- black2 = Color.new(0,0,0,100)
- startcolor = Color.new(0,0,255,150)
- endcolor = Color.new(0,255,255,150)
- w = width * actor.sp / actor.maxsp
- #黑色倒影
- draw_line(x+4, y+18, x+width+4, y+18, black, 7, black2)
- #画气条(横板渐变色,颜色变化法由樱雅在土提供)
- draw_line(x, y+14, x+w, y+14, startcolor, 7, endcolor)
- #写上SP两个大字,顺便表示SP的数值。
- self.contents.font.size = 20
- self.contents.font.color = system_color
- self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
- self.contents.font.color = actor.sp == 0 ? knockout_color :
- actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
- self.contents.draw_text(x, y, 68, 32, actor.sp.to_s, 2)
- self.contents.font.color = normal_color
- self.contents.draw_text(x + 68, y, 12, 32, "/", 1)
- self.contents.draw_text(x + 80, y, 48, 32, actor.maxsp.to_s)
- self.contents.font.size = 22
- end
- #--------------------------------------------------------------------------
- # ● ライン描画 by 桜雅 在土
- #--------------------------------------------------------------------------
- def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
- # 描写距離の計算。大きめに直角時の長さ。
- distance = (start_x - end_x).abs + (start_y - end_y).abs
- # 描写開始
- if end_color == start_color
- for i in 1..distance
- x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
- y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
- if width == 1
- self.contents.set_pixel(x, y, start_color)
- else
- self.contents.fill_rect(x, y, width, width, start_color)
- end
- end
- else
- for i in 1..distance
- x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
- y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
- r = start_color.red * (distance-i)/distance + end_color.red * i/distance
- g = start_color.green * (distance-i)/distance + end_color.green * i/distance
- b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
- a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
- if width == 1
- self.contents.set_pixel(x, y, Color.new(r, g, b, a))
- else
- self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
- end
- end
- end
- end
- ###########################################################################
复制代码 |
|