本帖最后由 soulsaga 于 2019-6-22 10:49 编辑
def draw_actor_hp_meter(actor,x, y) @meter_image = Cache.system("HP_Meter") @meter_cw = @meter_image.width / 3 @meter_ch = @meter_image.height @meter,np,nnp=[],[],[] if @meter.nil? for i in 0...$game_party.members.size @meter.push(Sprite.new) @meter[i].bitmap = Bitmap.new(@meter_cw,@meter_ch) @meter.z.push(101) @meter.x.push(x) @meter.y.push(y*i) @hp_flow = 0 @hp_flow_max = @meter_cw * 2 @np.push($game_party.members[i].hp) @nnp.push($game_party.members[i].mhp) end def update_hp_meter return if @meter_image == nil @hp_width,@hp_src_rect=[],[] if @hp_width.nil? for i in 0...$game_party.members.size @meter[i].bitmap.clear @hp_width.push(@meter_cw * @np[i] / @nnp[i]) @hp_src_rect[i] = Rect.new(@hp_flow[i], 0,@hp_width[i], @meter_ch) @meter.bitmap[i].blt(0,0, @meter_image, @hp_src_rect[i]) end @hp_flow += 1 @hp_flow = 0 if @hp_flow >= @hp_flow_max end end
def draw_actor_hp_meter(actor,x, y)
@meter_image = Cache.system("HP_Meter")
@meter_cw = @meter_image.width / 3
@meter_ch = @meter_image.height
@meter,np,nnp=[],[],[] if @meter.nil?
for i in 0...$game_party.members.size
@meter.push(Sprite.new)
@meter[i].bitmap = Bitmap.new(@meter_cw,@meter_ch)
@meter.z.push(101)
@meter.x.push(x)
@meter.y.push(y*i)
@hp_flow = 0
@hp_flow_max = @meter_cw * 2
@np.push($game_party.members[i].hp)
@nnp.push($game_party.members[i].mhp)
end
def update_hp_meter
return if @meter_image == nil
@hp_width,@hp_src_rect=[],[] if @hp_width.nil?
for i in 0...$game_party.members.size
@meter[i].bitmap.clear
@hp_width.push(@meter_cw * @np[i] / @nnp[i])
@hp_src_rect[i] = Rect.new(@hp_flow[i], 0,@hp_width[i], @meter_ch)
@meter.bitmap[i].blt(0,0, @meter_image, @hp_src_rect[i])
end
@hp_flow += 1
@hp_flow = 0 if @hp_flow >= @hp_flow_max
end
end
|