赞 0
VIP 2
好人卡 0
积分 1
经验 11270
最后登录 2016-9-21
在线时间 207 小时
Lv1.梦旅人
梦石 0
星屑 50
在线时间 207 小时
注册时间 2014-8-16
帖子 132
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
如题。敌人在左边,角色在右边。为什么敌人的名字却显示在了右边?如图:[pre lang="ruby" line="1" file="战斗显示敌人名字"]#==============================================================================
# 本脚本来自www.66RPG.com ,使用和转载请保留此信息
#==============================================================================
# ■ エネミーHP&SP(ver 0.98)
# □ カスタマイズポイント
#==============================================================================
#--------------------------------------#
# 大话西游单机论坛 rpg520.5d6d.com #
#--------------------------------------#
module PLAN_HPSP_DRAW
FONT_NAME = ["黑体"] # フォント
FONT_SIZE = 16 # フォントサイズ
FONT_BOLD = false # 太字
FONT_ITALIC = false # 斜体
DRAW_NAME = true # 名前の描画
DRAW_HP = false # HP の描画
DRAW_SP = false # SP の描画
DRAW_WIDTH = 80 # 描画幅
DRAW_HEIGHT = 3 * 32 # 描画高さ
DRAW_SPACE = 0 # 行間
DRAW_Y = 50 # Y 座標修正値
end
#==============================================================================
# ■ Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias plan_enemy_hpsp_draw_initialize initialize
def initialize(viewport, battler = nil)
# 元のメソッドに戻す
plan_enemy_hpsp_draw_initialize(viewport, battler)
# エネミーの場合
if @battler.is_a?(Game_Enemy)
width = PLAN_HPSP_DRAW::DRAW_WIDTH + 32
height = PLAN_HPSP_DRAW::DRAW_HEIGHT + 32
x = @battler.screen_x - width / 2
y = @battler.screen_y - height + 32 + PLAN_HPSP_DRAW::DRAW_Y
@enemy_hpsp_window = Window_Base.new(x, y, width, height)
@enemy_hpsp_window.contents = Bitmap.new(width - 32, height - 32)
@enemy_hpsp_window.contents.font.color = Color.new(2, 112, 16, 255)
@enemy_hpsp_window.contents.font.name = PLAN_HPSP_DRAW::FONT_NAME
@enemy_hpsp_window.contents.font.size = PLAN_HPSP_DRAW::FONT_SIZE
@enemy_hpsp_window.contents.font.bold = PLAN_HPSP_DRAW::FONT_BOLD
@enemy_hpsp_window.contents.font.italic = PLAN_HPSP_DRAW::FONT_ITALIC
y = 0
@old_enemy_hpsp = []
one_line = ((PLAN_HPSP_DRAW::FONT_SIZE * 100 / 28) * 32) / 100
if PLAN_HPSP_DRAW::DRAW_NAME
@enemy_hpsp_window.draw_actor_name(@battler, -15, y, width - 32)
y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
@old_enemy_hpsp.push(@battler.name)
end
@enemy_hpsp_window.opacity = 0
@enemy_hpsp_window.contents_opacity = 255
end
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
alias plan_enemy_hpsp_draw_dispose dispose
def dispose
# エネミーの場合
if @battler.is_a?(Game_Enemy)
@enemy_hpsp_window.dispose
end
# 元のメソッドに戻す
plan_enemy_hpsp_draw_dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias plan_enemy_hpsp_draw_update update
def update
# 元のメソッドに戻す
plan_enemy_hpsp_draw_update
# エネミーの場合
if @battler.is_a?(Game_Enemy)
@enemy_hpsp_window.visible = @battler_visible
# スプライトの座標を設定
width = PLAN_HPSP_DRAW::DRAW_WIDTH + 10
@enemy_hpsp_window.x = self.x - width / 2
@now_enemy_hpsp = []
if PLAN_HPSP_DRAW::DRAW_NAME
@now_enemy_hpsp.push(@battler.name)
end
if @old_enemy_hpsp != @now_enemy_hpsp and $game_temp.enemy_hpsp_refresh
@old_enemy_hpsp = @now_enemy_hpsp
@enemy_hpsp_window.contents.clear
y = 0
width = PLAN_HPSP_DRAW::DRAW_WIDTH + 32
one_line = ((PLAN_HPSP_DRAW::FONT_SIZE * 100 / 28) * 32) / 100
if PLAN_HPSP_DRAW::DRAW_NAME
@enemy_hpsp_window.draw_actor_name(@battler, 0, y, width - 32)
y += one_line + PLAN_HPSP_DRAW::DRAW_SPACE
end
Graphics.frame_reset
end
end
end
end
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 名前の描画
#--------------------------------------------------------------------------
def draw_actor_name(actor, x, y, width = 120, align = 0)
if $scene.is_a?(Scene_Battle)
align = 1
self.contents.font.color = Color.new(43, 212, 43, 255)
else
self.contents.font.color = normal_color
end
self.contents.draw_text(x, y, width, 32, actor.name, align)
end
end[/pre]