赞 | 0 |
VIP | 10 |
好人卡 | 49 |
积分 | 10 |
经验 | 22958 |
最后登录 | 2020-8-1 |
在线时间 | 2161 小时 |
Lv3.寻梦者 酱油的
- 梦石
- 0
- 星屑
- 1035
- 在线时间
- 2161 小时
- 注册时间
- 2007-12-22
- 帖子
- 3271
|
替換這個,顔色,坐標等部分自己調節
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Slant Bar
#--------------------------------------------------------------------------
def draw_slant_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))
# Draw Border
for i in 0..height
self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
end
# Draw Background
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
# Draws Bar
for i in 1..( (min / max.to_f) * 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
#==============================================================================
# ■ Window_BattleStatus
#------------------------------------------------------------------------------
# 显示战斗画面同伴状态的窗口。
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(-10, 343, 740, 360)#第一个数字为状态栏最左端x坐标、第二个数字为整体y坐标
self.opacity = 0
self.contents = Bitmap.new(width - 32, height - 32)
@level_up_flags = [false, false, false, false]
self.contents.font.name = "Arial Black"
refresh
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
super
end
#--------------------------------------------------------------------------
# ● 设置升级标志
# actor_index : 角色索引
#--------------------------------------------------------------------------
def level_up(actor_index)
@level_up_flags[actor_index] = true
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors
actor_x = i * 210 + 120#----血条之间的距离/血条离左角的距离(有两个)
draw_actor_name(actor, actor_x, 0)
draw_actor_hp(actor, actor_x, 32, 120)
draw_actor_sp(actor, actor_x, 64, 120)
x = i * 210
a = actor.id.to_s + "_战斗状态"
bitmap=Bitmap.new("Graphics/System/menu/Back/#{a}")
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
self.contents.blt(x, 0, bitmap, src_rect)
if @level_up_flags
self.contents.font.color = normal_color
self.contents.draw_text(actor_x, 96, 120, 32, "等级提升")
else
draw_actor_state(actor, actor_x, 96)
end
end
for i in 0...$game_party.actors.size
actor = $game_party.actors
actor_x = i * 210 + 120#----血条之间的距离/血条离左角的距离(有两个)
#以下为血槽坐标:
draw_slant_bar(actor_x, 43, actor.hp, actor.maxhp, 80)#第一个数字调整hp高度,第一个数字调整hp长度
draw_slant_bar(actor_x, 83, actor.sp, actor.maxsp, 80, 6, bar_color = Color.new(150, 0, 150, 255), end_color = Color.new(0, 0, 255, 255))
draw_actor_name(actor, actor_x, 0)
draw_actor_hp(actor, actor_x, 32, 120)
draw_actor_sp(actor, actor_x, 64, 120)
end
end
#--------------------------------------------------------------------------
# ● 描绘 HP
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 描画目标的宽
#--------------------------------------------------------------------------
def draw_actor_hp(actor, x, y, width = 144)
# 描绘字符串 "HP"
# 描绘 HP
self.contents.font.color = actor.hp == 100 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : system_color
self.contents.draw_text(x, y - 15, 48, 32, actor.hp.to_s)
self.contents.draw_text(x + 35, y - 15, 48, 32, "/")
self.contents.draw_text(x + 40, y - 15, 48, 32, actor.maxhp.to_s)
end
#--------------------------------------------------------------------------
# ● 描绘 SP
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# width : 描画目标的宽
#--------------------------------------------------------------------------
def draw_actor_sp(actor, x, y, width = 144)
# 描绘字符串 "SP"
# 描绘 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 - 15, 48, 32, actor.sp.to_s)
self.contents.draw_text(x + 48, y - 15, 48, 32, "/")
self.contents.draw_text(x + 60, y - 15, 48, 32, actor.maxsp.to_s)
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
# 主界面的不透明度下降
if $game_temp.battle_main_phase
self.contents_opacity -= 4 if self.contents_opacity > 255
else
self.contents_opacity += 4 if self.contents_opacity < 255
end
end
end 系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~ |
|