Project1
标题: VA地图显示HP [打印本页]
作者: love896624434 时间: 2013-3-27 21:01
标题: VA地图显示HP
本帖最后由 love896624434 于 2013-3-28 07:40 编辑
在做魔塔来着,发现地图不能显示HP真心不方便。搜了一下,只找到这个http://rpg.blue/thread-217052-1-1.html
但是脚本插进去完全没有反应,什么都没显示。求解了,怎么显示HP?只显示名字和HP就够了,其他的不显示。
因为我做的是魔塔,所以透明度最好高一点,能看清血量就够了。
求帮助求调教
作者: j433463 时间: 2013-3-28 00:24
本帖最后由 j433463 于 2013-3-28 06:13 编辑
写脚本我不在行,这脚本原本是我自己写来用在游戏中显示版本号的,稍作修改,看看能不能用。
#encoding:utf-8
#==============================================================================
# ■ Window_Variables
#------------------------------------------------------------------------------
# 地图上显示变量窗口
#==============================================================================
# 在不想要显示的地图备注栏中放上 <NOHPHUB> 就可以隐藏。
#==============================================================================
HPHUB_X = 0 #显示变量的 X 座标
HPHUB_Y = 0 #显示变量的 Y 座标
class Window_Variables < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize
super(0, 0, window_width, fitting_height(1))
self.back_opacity = 0
self.opacity = 0
@icon = 0
@variable = 0
@o_hp = 0
refresh
end
#--------------------------------------------------------------------------
# ● 取得视窗的宽度
#--------------------------------------------------------------------------
def window_width
return 350
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
return if $game_party.leader.hp == @o_hp
@o_hp = $game_party.leader.hp
contents.clear
draw_text(HPHUB_X, HPHUB_Y, 328, 24, $game_party.leader.name, 0)
@x = HPHUB_X + $game_party.leader.name.size * self.contents.font.size #HP 的显示 X 座标
draw_icon(122, @x, HPHUB_Y, true)
draw_text(@x + self.contents.font.size + 4, HPHUB_Y, 328, 24, @o_hp, 0)
end
end
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
# 地图生成窗口
#==============================================================================
class Scene_Map < Scene_Base
alias new_start start
def start
new_start
@varia_window = Window_Variables.new
@varia_window.visible = false
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
alias new_update update
def update
new_update
# 开关控制
if (/<NOHPHUB>/i.match($game_map.note)) != nil
@varia_window.visible = false
close_varia_window
else
@varia_window.refresh
@varia_window.visible = true
end
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
alias new_terminate terminate
def terminate
@varia_window.dispose
new_terminate
end
#--------------------------------------------------------------------------
# ● 关闭
#--------------------------------------------------------------------------
def close_varia_window
@varia_window.close
update until @varia_window.close?
end
end
#==============================================================================
# ■ Game_Map
#------------------------------------------------------------------------------
# 管理地图的类。
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ● 取得地图备注栏
#--------------------------------------------------------------------------
def note
@map.note
end
end
#encoding:utf-8
#==============================================================================
# ■ Window_Variables
#------------------------------------------------------------------------------
# 地图上显示变量窗口
#==============================================================================
# 在不想要显示的地图备注栏中放上 <NOHPHUB> 就可以隐藏。
#==============================================================================
HPHUB_X = 0 #显示变量的 X 座标
HPHUB_Y = 0 #显示变量的 Y 座标
class Window_Variables < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize
super(0, 0, window_width, fitting_height(1))
self.back_opacity = 0
self.opacity = 0
@icon = 0
@variable = 0
@o_hp = 0
refresh
end
#--------------------------------------------------------------------------
# ● 取得视窗的宽度
#--------------------------------------------------------------------------
def window_width
return 350
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
return if $game_party.leader.hp == @o_hp
@o_hp = $game_party.leader.hp
contents.clear
draw_text(HPHUB_X, HPHUB_Y, 328, 24, $game_party.leader.name, 0)
@x = HPHUB_X + $game_party.leader.name.size * self.contents.font.size #HP 的显示 X 座标
draw_icon(122, @x, HPHUB_Y, true)
draw_text(@x + self.contents.font.size + 4, HPHUB_Y, 328, 24, @o_hp, 0)
end
end
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
# 地图生成窗口
#==============================================================================
class Scene_Map < Scene_Base
alias new_start start
def start
new_start
@varia_window = Window_Variables.new
@varia_window.visible = false
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
alias new_update update
def update
new_update
# 开关控制
if (/<NOHPHUB>/i.match($game_map.note)) != nil
@varia_window.visible = false
close_varia_window
else
@varia_window.refresh
@varia_window.visible = true
end
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
alias new_terminate terminate
def terminate
@varia_window.dispose
new_terminate
end
#--------------------------------------------------------------------------
# ● 关闭
#--------------------------------------------------------------------------
def close_varia_window
@varia_window.close
update until @varia_window.close?
end
end
#==============================================================================
# ■ Game_Map
#------------------------------------------------------------------------------
# 管理地图的类。
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ● 取得地图备注栏
#--------------------------------------------------------------------------
def note
@map.note
end
end
补上截图:
如果把 def refresh 那一段改成这样:
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
return if $game_party.leader.hp == @o_hp
@o_hp = $game_party.leader.hp
contents.clear
draw_actor_name($game_party.leader, HPHUB_X, HPHUB_Y)
@x = HPHUB_X + $game_party.leader.name.size * self.contents.font.size #HP 的显示 X 座标
draw_icon(122, @x, HPHUB_Y, true) #爱心图标
draw_actor_hp($game_party.leader, @x + self.contents.font.size + 4, HPHUB_Y)
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
return if $game_party.leader.hp == @o_hp
@o_hp = $game_party.leader.hp
contents.clear
draw_actor_name($game_party.leader, HPHUB_X, HPHUB_Y)
@x = HPHUB_X + $game_party.leader.name.size * self.contents.font.size #HP 的显示 X 座标
draw_icon(122, @x, HPHUB_Y, true) #爱心图标
draw_actor_hp($game_party.leader, @x + self.contents.font.size + 4, HPHUB_Y)
end
就会如这截图显示血槽了:
因为使用的是系统菜单上的血槽,所以如果要改血槽颜色或血槽高度,必须去 Window_Base 内改,但一改就所有菜单用到血槽的都会跟着改变。
如果想要连文字和血槽都半透明化,可以在 self.opacity = 0 的下方加上 self.contents.opacity = n,这个 n 是数字,0~255,数字越小越透明,255 完全不透明。
作者: j433463 时间: 2013-3-28 09:15
又作了一些修改,主要是加了按钮切换显示 / 隐藏功能,以及背景渐层底色,预设的 :C 是指键盘的 Z 键:
#encoding:utf-8
#==============================================================================
# ■ Window_Variables
#------------------------------------------------------------------------------
# 地图上显示变量窗口
#==============================================================================
# 在不想要显示的地图备注栏中放上 <NOHPHUB> 就可以隐藏。
#==============================================================================
HPHUB_X = 0 #显示变量的 X 座标
HPHUB_Y = 0 #显示变量的 Y 座标
HPHUB_INPUT = :C #切换显示/隐藏按钮, 若不想要按钮切换, 等号右边可以清除, 或改为 nil 或 "" 或 ''
class Window_Variables < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize
super(0, 0, window_width, fitting_height(1))
self.opacity = 0 #窗口整体不透明度
self.back_opacity = 120 #窗口背景底色不透明度
@icon = 0
@variable = 0
@o_hp = 0
refresh
end
#--------------------------------------------------------------------------
# ● 取得视窗的宽度
#--------------------------------------------------------------------------
def window_width
return 355
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
return if $game_party.leader.hp == @o_hp
@o_hp = $game_party.leader.hp
contents.clear
draw_background(contents.rect)
draw_actor_name($game_party.leader, HPHUB_X, HPHUB_Y)
@x = HPHUB_X + $game_party.leader.name.size * self.contents.font.size #HP 的显示 X 座标
draw_icon(122, @x, HPHUB_Y, true)
draw_actor_hp($game_party.leader, @x + self.contents.font.size + 4, HPHUB_Y)
end
#--------------------------------------------------------------------------
# ● 绘制背景
#--------------------------------------------------------------------------
def draw_background(rect)
temp_rect = rect.clone
contents.gradient_fill_rect(temp_rect, back_color1, back_color2)
end
#--------------------------------------------------------------------------
# ● 取得背景色 1
#--------------------------------------------------------------------------
def back_color1
Color.new(0, 0, 0, 90)
end
#--------------------------------------------------------------------------
# ● 取得背景色 2
#--------------------------------------------------------------------------
def back_color2
Color.new(0, 0, 0, 30)
end
end
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
# 地图生成窗口
#==============================================================================
class Scene_Map < Scene_Base
alias new_start start
def start
new_start
@varia_window = Window_Variables.new
@varia_window.visible = false
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
alias new_update update
def update
new_update
#地图备注检查
return if (/<NOHPHUB>/i.match($game_map.note)) != nil
#初始值
@show_hp_hud = true if @show_hp_hud == nil
#按键切换开/关
if HPHUB_INPUT != nil && HPHUB_INPUT != "" && HPHUB_INPUT != ''
if Input.trigger?(HPHUB_INPUT)
if @show_hp_hud != true
@show_hp_hud = true
else
@show_hp_hud = false
end
end
end
#显示/隐藏执行
if @show_hp_hud == true
@varia_window.refresh
@varia_window.visible = true
else
@varia_window.visible = false
#close_varia_window
end
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
alias new_terminate terminate
def terminate
@varia_window.dispose
new_terminate
end
#--------------------------------------------------------------------------
# ● 关闭
#--------------------------------------------------------------------------
def close_varia_window
@varia_window.close
update until @varia_window.close?
end
end
#==============================================================================
# ■ Game_Map
#------------------------------------------------------------------------------
# 管理地图的类。
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ● 取得地图备注栏
#--------------------------------------------------------------------------
def note
@map.note
end
end
#encoding:utf-8
#==============================================================================
# ■ Window_Variables
#------------------------------------------------------------------------------
# 地图上显示变量窗口
#==============================================================================
# 在不想要显示的地图备注栏中放上 <NOHPHUB> 就可以隐藏。
#==============================================================================
HPHUB_X = 0 #显示变量的 X 座标
HPHUB_Y = 0 #显示变量的 Y 座标
HPHUB_INPUT = :C #切换显示/隐藏按钮, 若不想要按钮切换, 等号右边可以清除, 或改为 nil 或 "" 或 ''
class Window_Variables < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize
super(0, 0, window_width, fitting_height(1))
self.opacity = 0 #窗口整体不透明度
self.back_opacity = 120 #窗口背景底色不透明度
@icon = 0
@variable = 0
@o_hp = 0
refresh
end
#--------------------------------------------------------------------------
# ● 取得视窗的宽度
#--------------------------------------------------------------------------
def window_width
return 355
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
return if $game_party.leader.hp == @o_hp
@o_hp = $game_party.leader.hp
contents.clear
draw_background(contents.rect)
draw_actor_name($game_party.leader, HPHUB_X, HPHUB_Y)
@x = HPHUB_X + $game_party.leader.name.size * self.contents.font.size #HP 的显示 X 座标
draw_icon(122, @x, HPHUB_Y, true)
draw_actor_hp($game_party.leader, @x + self.contents.font.size + 4, HPHUB_Y)
end
#--------------------------------------------------------------------------
# ● 绘制背景
#--------------------------------------------------------------------------
def draw_background(rect)
temp_rect = rect.clone
contents.gradient_fill_rect(temp_rect, back_color1, back_color2)
end
#--------------------------------------------------------------------------
# ● 取得背景色 1
#--------------------------------------------------------------------------
def back_color1
Color.new(0, 0, 0, 90)
end
#--------------------------------------------------------------------------
# ● 取得背景色 2
#--------------------------------------------------------------------------
def back_color2
Color.new(0, 0, 0, 30)
end
end
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
# 地图生成窗口
#==============================================================================
class Scene_Map < Scene_Base
alias new_start start
def start
new_start
@varia_window = Window_Variables.new
@varia_window.visible = false
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
alias new_update update
def update
new_update
#地图备注检查
return if (/<NOHPHUB>/i.match($game_map.note)) != nil
#初始值
@show_hp_hud = true if @show_hp_hud == nil
#按键切换开/关
if HPHUB_INPUT != nil && HPHUB_INPUT != "" && HPHUB_INPUT != ''
if Input.trigger?(HPHUB_INPUT)
if @show_hp_hud != true
@show_hp_hud = true
else
@show_hp_hud = false
end
end
end
#显示/隐藏执行
if @show_hp_hud == true
@varia_window.refresh
@varia_window.visible = true
else
@varia_window.visible = false
#close_varia_window
end
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
alias new_terminate terminate
def terminate
@varia_window.dispose
new_terminate
end
#--------------------------------------------------------------------------
# ● 关闭
#--------------------------------------------------------------------------
def close_varia_window
@varia_window.close
update until @varia_window.close?
end
end
#==============================================================================
# ■ Game_Map
#------------------------------------------------------------------------------
# 管理地图的类。
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ● 取得地图备注栏
#--------------------------------------------------------------------------
def note
@map.note
end
end
测试截图:
作者: love896624434 时间: 2013-3-28 13:10
j433463 发表于 2013-3-28 09:15 
又作了一些修改,主要是加了按钮切换显示 / 隐藏功能,以及背景渐层底色,预设的 :C 是指键盘的 Z 键:
#e ...
多谢大神~附上一张我游戏的主菜单截图,自己做的,实在不怎么样=。=
作者: j433463 时间: 2013-3-28 13:20
背景不错,就是字普通了点,可以上网去搜寻一下,找些比较合意的字型下载,甚至网络上有线上制作 LOGO 文字的,弄出个漂亮的大标题出来很容易。
作者: j433463 时间: 2013-3-28 14:11
建议找 true type 字型,不要找那种点阵或书法帖转成的字,看您那是繁体字标题,那么找一找全真,文鼎,金梅,方正,超研泽的字型吧,这五种应该不难找。
找到后的 .ttf 档要用 Win 的字型安装把它安装好,已经开启的 PS 或文书软体要关掉重开,最好是安装完字型之后先重开机一次,让系统整理一遍已安装的字型。
作者: love896624434 时间: 2013-3-28 14:28
j433463 发表于 2013-3-28 14:11 
建议找 true type 字型,不要找那种点阵或书法帖转成的字,看您那是繁体字标题,那么找一找全真,文鼎,金 ...
了解!上网找了个logo设计弄了一下,现在弄成这样了~
作者: j433463 时间: 2013-3-28 16:55
这标题如何?
作者: wshzya 时间: 2013-4-3 22:44
试试这个,人物小头像体力魔力特技都有显示,只不过没有明显数值。要打开100号开关(这个可以改):
#==============================================================================
# ■ 碧の軌跡っぽいステータス表示
# @version 0.13 12/01/07
# @author さば缶
#------------------------------------------------------------------------------
# マップ画面下にステータスが表示されます
#
# ■用意するもの
# Graphics\System の下に Actor_bg1 ~ Actor_bg3
# Graphics\Faces の下に 顔グラを50%に縮小したファイル "通常のファイル名_s"
# 例 Actor1.png → Actor1_s.png
# ※このファイルが存在しない場合、プログラムで縮小するため非常に荒くなります
#
#==============================================================================
module Saba
module KisekiStatus
# このスイッチがONの場合、ステータスを表示します
INVISIBLE_SWITCH = 100
# TPを表示する場合、true に設定します。
SHOW_TP = true
end
end
class Window_KisekiStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, Graphics.height-window_height+18, Graphics.width, window_height)
self.opacity = 0
self.visible = $game_switches[Saba::KisekiStatus::INVISIBLE_SWITCH]
refresh
end
def refresh
@last_hps = []
@last_mps = []
@last_tps = []
super
end
#--------------------------------------------------------------------------
# ● 項目数の取得
#--------------------------------------------------------------------------
def item_max
$game_party.battle_members.size
end
#--------------------------------------------------------------------------
# ● ウィンドウの高さを取得
#--------------------------------------------------------------------------
def window_height
item_height+32
end
#--------------------------------------------------------------------------
# ● 項目の高さを取得
#--------------------------------------------------------------------------
def item_height
52
end
#--------------------------------------------------------------------------
# ● 項目の幅を取得
#--------------------------------------------------------------------------
def item_width
return 70
end
#--------------------------------------------------------------------------
# ● 桁数の取得
#--------------------------------------------------------------------------
def col_max
return $game_party.battle_members.size
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
actor = $game_party.battle_members[index]
rect = item_rect(index)
bg_bitmap = Cache.system("Actor_bg1")
contents.blt(rect.x, rect.y, bg_bitmap, bg_bitmap.rect)
small_bitmap = Bitmap.new(48, 48)
begin
bitmap = Cache.face(actor.face_name + "_s")
rescue
end
if bitmap == nil
bitmap = Cache.face(actor.face_name)
face_rect = Rect.new(actor.face_index % 4 * 96, actor.face_index / 4 * 96, 96, 96)
small_bitmap.stretch_blt(Rect.new(0, 0, 48, 48), bitmap, face_rect)
else
small_bitmap.blt(0, 0, bitmap, Rect.new(actor.face_index % 4 * 48, actor.face_index / 4 * 48, 48, 48))
end
bitmap.dispose
clear_edge(small_bitmap)
contents.blt(rect.x+2, 2, small_bitmap, Rect.new(0, 0, 48, 48))
small_bitmap.dispose
if actor.dead?
bg_bitmap = Cache.system("Actor_bg1")
contents.blt(rect.x, rect.y, bg_bitmap, bg_bitmap.rect)
bg_bitmap = Cache.system("Actor_bg3")
else
bg_bitmap = Cache.system("Actor_bg2")
end
contents.blt(rect.x, rect.y, bg_bitmap, bg_bitmap.rect)
draw_gauge(rect.x + 47, rect.y+20, 50, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
draw_gauge(rect.x + 42, rect.y+24, 50, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
if Saba::KisekiStatus::SHOW_TP
draw_gauge(rect.x + 37, rect.y+28, 50, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
end
@last_hps.push(actor.hp_rate)
@last_mps.push(actor.mp_rate)
@last_tps.push(actor.tp_rate)
end
#--------------------------------------------------------------------------
# ● 顔画像の端を消します
#--------------------------------------------------------------------------
def clear_edge(bitmap)
22.times { |i|
bitmap.clear_rect(0, i, 22 - i, 1)
bitmap.clear_rect(26 + i, i, 22 - i, 1)
bitmap.clear_rect(0, i + 26, i, 1)
bitmap.clear_rect(48 - i, i + 26, i, 1)
}
end
#--------------------------------------------------------------------------
# ● ゲージの描画
# rate : 割合(1.0 で満タン)
# color1 : グラデーション 左端
# color2 : グラデーション 右端
#--------------------------------------------------------------------------
def draw_gauge(x, y, width, rate, color1, color2)
fill_w = (width * rate).to_i
gauge_y = y + line_height - 8
contents.fill_rect(x-2, gauge_y-1, width+4, 4, text_color(15))
contents.fill_rect(x-1, gauge_y-2, width+2, 6, text_color(15))
contents.fill_rect(x, gauge_y, width, 2, gauge_back_color)
contents.gradient_fill_rect(x, gauge_y, fill_w, 2, color1, color2)
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
if $game_switches[Saba::KisekiStatus::INVISIBLE_SWITCH] == true &&
! $game_message.busy? && ! $game_message.visible
self.visible = true
else
self.visible = false
return
end
hps = []
mps = []
tps = []
for actor in $game_party.battle_members
hps.push(actor.hp_rate)
mps.push(actor.mp_rate)
tps.push(actor.tp_rate)
end
if @last_hps != hps || @last_mps != mps || @last_tps != tps
refresh
end
end
end
class Scene_Map
#--------------------------------------------------------------------------
# ● 全ウィンドウの作成
#--------------------------------------------------------------------------
alias saba_kiseki_status_create_all_windows create_all_windows
def create_all_windows
saba_kiseki_status_create_all_windows
@kiseki_status_window = Window_KisekiStatus.new
end
end
#==============================================================================
# ■ 碧の軌跡っぽいステータス表示
# @version 0.13 12/01/07
# @author さば缶
#------------------------------------------------------------------------------
# マップ画面下にステータスが表示されます
#
# ■用意するもの
# Graphics\System の下に Actor_bg1 ~ Actor_bg3
# Graphics\Faces の下に 顔グラを50%に縮小したファイル "通常のファイル名_s"
# 例 Actor1.png → Actor1_s.png
# ※このファイルが存在しない場合、プログラムで縮小するため非常に荒くなります
#
#==============================================================================
module Saba
module KisekiStatus
# このスイッチがONの場合、ステータスを表示します
INVISIBLE_SWITCH = 100
# TPを表示する場合、true に設定します。
SHOW_TP = true
end
end
class Window_KisekiStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, Graphics.height-window_height+18, Graphics.width, window_height)
self.opacity = 0
self.visible = $game_switches[Saba::KisekiStatus::INVISIBLE_SWITCH]
refresh
end
def refresh
@last_hps = []
@last_mps = []
@last_tps = []
super
end
#--------------------------------------------------------------------------
# ● 項目数の取得
#--------------------------------------------------------------------------
def item_max
$game_party.battle_members.size
end
#--------------------------------------------------------------------------
# ● ウィンドウの高さを取得
#--------------------------------------------------------------------------
def window_height
item_height+32
end
#--------------------------------------------------------------------------
# ● 項目の高さを取得
#--------------------------------------------------------------------------
def item_height
52
end
#--------------------------------------------------------------------------
# ● 項目の幅を取得
#--------------------------------------------------------------------------
def item_width
return 70
end
#--------------------------------------------------------------------------
# ● 桁数の取得
#--------------------------------------------------------------------------
def col_max
return $game_party.battle_members.size
end
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
def draw_item(index)
actor = $game_party.battle_members[index]
rect = item_rect(index)
bg_bitmap = Cache.system("Actor_bg1")
contents.blt(rect.x, rect.y, bg_bitmap, bg_bitmap.rect)
small_bitmap = Bitmap.new(48, 48)
begin
bitmap = Cache.face(actor.face_name + "_s")
rescue
end
if bitmap == nil
bitmap = Cache.face(actor.face_name)
face_rect = Rect.new(actor.face_index % 4 * 96, actor.face_index / 4 * 96, 96, 96)
small_bitmap.stretch_blt(Rect.new(0, 0, 48, 48), bitmap, face_rect)
else
small_bitmap.blt(0, 0, bitmap, Rect.new(actor.face_index % 4 * 48, actor.face_index / 4 * 48, 48, 48))
end
bitmap.dispose
clear_edge(small_bitmap)
contents.blt(rect.x+2, 2, small_bitmap, Rect.new(0, 0, 48, 48))
small_bitmap.dispose
if actor.dead?
bg_bitmap = Cache.system("Actor_bg1")
contents.blt(rect.x, rect.y, bg_bitmap, bg_bitmap.rect)
bg_bitmap = Cache.system("Actor_bg3")
else
bg_bitmap = Cache.system("Actor_bg2")
end
contents.blt(rect.x, rect.y, bg_bitmap, bg_bitmap.rect)
draw_gauge(rect.x + 47, rect.y+20, 50, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
draw_gauge(rect.x + 42, rect.y+24, 50, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
if Saba::KisekiStatus::SHOW_TP
draw_gauge(rect.x + 37, rect.y+28, 50, actor.tp_rate, tp_gauge_color1, tp_gauge_color2)
end
@last_hps.push(actor.hp_rate)
@last_mps.push(actor.mp_rate)
@last_tps.push(actor.tp_rate)
end
#--------------------------------------------------------------------------
# ● 顔画像の端を消します
#--------------------------------------------------------------------------
def clear_edge(bitmap)
22.times { |i|
bitmap.clear_rect(0, i, 22 - i, 1)
bitmap.clear_rect(26 + i, i, 22 - i, 1)
bitmap.clear_rect(0, i + 26, i, 1)
bitmap.clear_rect(48 - i, i + 26, i, 1)
}
end
#--------------------------------------------------------------------------
# ● ゲージの描画
# rate : 割合(1.0 で満タン)
# color1 : グラデーション 左端
# color2 : グラデーション 右端
#--------------------------------------------------------------------------
def draw_gauge(x, y, width, rate, color1, color2)
fill_w = (width * rate).to_i
gauge_y = y + line_height - 8
contents.fill_rect(x-2, gauge_y-1, width+4, 4, text_color(15))
contents.fill_rect(x-1, gauge_y-2, width+2, 6, text_color(15))
contents.fill_rect(x, gauge_y, width, 2, gauge_back_color)
contents.gradient_fill_rect(x, gauge_y, fill_w, 2, color1, color2)
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
if $game_switches[Saba::KisekiStatus::INVISIBLE_SWITCH] == true &&
! $game_message.busy? && ! $game_message.visible
self.visible = true
else
self.visible = false
return
end
hps = []
mps = []
tps = []
for actor in $game_party.battle_members
hps.push(actor.hp_rate)
mps.push(actor.mp_rate)
tps.push(actor.tp_rate)
end
if @last_hps != hps || @last_mps != mps || @last_tps != tps
refresh
end
end
end
class Scene_Map
#--------------------------------------------------------------------------
# ● 全ウィンドウの作成
#--------------------------------------------------------------------------
alias saba_kiseki_status_create_all_windows create_all_windows
def create_all_windows
saba_kiseki_status_create_all_windows
@kiseki_status_window = Window_KisekiStatus.new
end
end
欢迎光临 Project1 (https://rpg.blue/) |
Powered by Discuz! X3.1 |