赞 | 1 |
VIP | 0 |
好人卡 | 0 |
积分 | 76 |
经验 | 14958 |
最后登录 | 2024-11-10 |
在线时间 | 1157 小时 |
Lv4.逐梦者
- 梦石
- 0
- 星屑
- 7570
- 在线时间
- 1157 小时
- 注册时间
- 2016-9-10
- 帖子
- 165
|
1楼
楼主 |
发表于 2016-12-22 00:43:00
|
只看该作者
本帖最后由 RaidenInfinity 于 2016-12-22 00:50 编辑
@RaidenInfinity
脚本盲,没改过脚本
敌人血条脚本如下,麻烦指导一下,谢谢
#============================================================================== # F08 - 战斗敌人显示血条·改 - By芙蕾娅 # 对应横板战斗版本 #------------------------------------------------------------------------------ # ★ - 新增 ☆ - 修改 ■ - 删除 ● - 无变更 #============================================================================== module Freya # 隐藏HP的文本 HideGaugeText = "Hide_Gauge" # 血条颜色 EnemyHPGaugeColor1 = Color.new(255,255,0) EnemyHPGaugeColor2 = Color.new(255,66,0) end #============================================================================== # ■ Sprite_Battler_HP #------------------------------------------------------------------------------ # 显示战斗者的生命在战斗者的精灵下面。 #============================================================================== class Sprite_Battler_HP < Sprite #-------------------------------------------------------------------------- # ● 初始化对象 #-------------------------------------------------------------------------- def initialize(viewport,battler) super(viewport) return if battler.nil? [url=home.php?mod=space&uid=133701]@battler[/url] = battler @last_hp = 0 create_bitmap update end #-------------------------------------------------------------------------- # ● 释放 #-------------------------------------------------------------------------- def dispose self.bitmap.dispose super end #-------------------------------------------------------------------------- # ● 生成位图 #-------------------------------------------------------------------------- def create_bitmap @last_hp = @battler.hp bw = 96 bh = 24 self.bitmap = Bitmap.new(bw, bh) self.bitmap.fill_rect(0, 0, bw, 6, Color.new(32,32,64)) if Freya::Gauge_Type.nil? or Freya::Gauge_Type == 0 hp = ((bw) * @battler.hp_rate).to_i self.bitmap.gradient_fill_rect(0, 0, hp, 6, Freya::EnemyHPGaugeColor1, Freya::EnemyHPGaugeColor2) elsif Freya::Gauge_Type == 1 hp = ((width - 2) * @battler.hp_rate).to_i self.bitmap.gradient_fill_rect(1, 1, hp, 6 - 2, Freya::EnemyHPGaugeColor1, Freya::EnemyHPGaugeColor2) elsif Freya::Gauge_Type == 2 hp = ((width) * @battler.hp_rate).to_i self.bitmap.gradient_fill_rect(0, 0, hp / 2, 6, Freya::EnemyHPGaugeColor1, Freya::EnemyHPGaugeColor2) self.bitmap.gradient_fill_rect(hp / 2, 0, hp / 2, 6, Freya::EnemyHPGaugeColor2, Freya::EnemyHPGaugeColor1) elsif Freya::Gauge_Type == 3 hp = ((width - 2) * @battler.hp_rate).to_i self.bitmap.gradient_fill_rect(1, 1, hp / 2, 6 - 2, Freya::EnemyHPGaugeColor1, Freya::EnemyHPGaugeColor2) self.bitmap.gradient_fill_rect((hp / 2) + 1, 1, hp / 2, 6 - 2, Freya::EnemyHPGaugeColor2, Freya::EnemyHPGaugeColor1) end self.bitmap.draw_text(0,0,bw,24,@battler.name) end #-------------------------------------------------------------------------- # ● 更新画面 #-------------------------------------------------------------------------- def update super unless self.bitmap.nil? self.z = @battler.sv.z + 20 create_bitmap if @last_hp != @battler.hp hide = $data_enemies[@battler.enemy_id].note.include?(Freya::HideGaugeText) self.opacity = 0 if @battler.hp == 0 or hide end end end #============================================================================== # ■ Sprite_Battler #------------------------------------------------------------------------------ # 显示战斗者的精灵。根据 Game_Battler 类的实例自动变化。 #============================================================================== class Sprite_Battler < Sprite_Base #-------------------------------------------------------------------------- # ☆ 初始化对象 #-------------------------------------------------------------------------- alias initialize_freya_enemy_hp initialize def initialize(viewport, battler = nil) initialize_freya_enemy_hp(viewport, battler) if @battler.is_a?(Game_Enemy) @hp_gauge = Sprite_Battler_HP.new(viewport, battler) end end #-------------------------------------------------------------------------- # ☆ 释放 #-------------------------------------------------------------------------- alias dispose_freya_enemy_hp dispose def dispose dispose_freya_enemy_hp unless @hp_gauge.nil? @hp_gauge.dispose end end #-------------------------------------------------------------------------- # ☆ 更新画面 #-------------------------------------------------------------------------- alias update_freya_enemy_hp update def update update_freya_enemy_hp @hp_gauge.update unless @hp_gauge.nil? end alias update_freya_position update_position def update_position update_freya_position @hp_gauge.x = self.x - 48 unless @hp_gauge.nil? @hp_gauge.y = self.y unless @hp_gauge.nil? end end
#==============================================================================
# F08 - 战斗敌人显示血条·改 - By芙蕾娅
# 对应横板战斗版本
#------------------------------------------------------------------------------
# ★ - 新增 ☆ - 修改 ■ - 删除 ● - 无变更
#==============================================================================
module Freya
# 隐藏HP的文本
HideGaugeText = "Hide_Gauge"
# 血条颜色
EnemyHPGaugeColor1 = Color.new(255,255,0)
EnemyHPGaugeColor2 = Color.new(255,66,0)
end
#==============================================================================
# ■ Sprite_Battler_HP
#------------------------------------------------------------------------------
# 显示战斗者的生命在战斗者的精灵下面。
#==============================================================================
class Sprite_Battler_HP < Sprite
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
def initialize(viewport,battler)
super(viewport)
return if battler.nil?
[url=home.php?mod=space&uid=133701]@battler[/url] = battler
@last_hp = 0
create_bitmap
update
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
self.bitmap.dispose
super
end
#--------------------------------------------------------------------------
# ● 生成位图
#--------------------------------------------------------------------------
def create_bitmap
@last_hp = @battler.hp
bw = 96
bh = 24
self.bitmap = Bitmap.new(bw, bh)
self.bitmap.fill_rect(0, 0, bw, 6, Color.new(32,32,64))
if Freya::Gauge_Type.nil? or Freya::Gauge_Type == 0
hp = ((bw) * @battler.hp_rate).to_i
self.bitmap.gradient_fill_rect(0, 0, hp, 6, Freya::EnemyHPGaugeColor1, Freya::EnemyHPGaugeColor2)
elsif Freya::Gauge_Type == 1
hp = ((width - 2) * @battler.hp_rate).to_i
self.bitmap.gradient_fill_rect(1, 1, hp, 6 - 2, Freya::EnemyHPGaugeColor1, Freya::EnemyHPGaugeColor2)
elsif Freya::Gauge_Type == 2
hp = ((width) * @battler.hp_rate).to_i
self.bitmap.gradient_fill_rect(0, 0, hp / 2, 6, Freya::EnemyHPGaugeColor1, Freya::EnemyHPGaugeColor2)
self.bitmap.gradient_fill_rect(hp / 2, 0, hp / 2, 6, Freya::EnemyHPGaugeColor2, Freya::EnemyHPGaugeColor1)
elsif Freya::Gauge_Type == 3
hp = ((width - 2) * @battler.hp_rate).to_i
self.bitmap.gradient_fill_rect(1, 1, hp / 2, 6 - 2, Freya::EnemyHPGaugeColor1, Freya::EnemyHPGaugeColor2)
self.bitmap.gradient_fill_rect((hp / 2) + 1, 1, hp / 2, 6 - 2, Freya::EnemyHPGaugeColor2, Freya::EnemyHPGaugeColor1)
end
self.bitmap.draw_text(0,0,bw,24,@battler.name)
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
unless self.bitmap.nil?
self.z = @battler.sv.z + 20
create_bitmap if @last_hp != @battler.hp
hide = $data_enemies[@battler.enemy_id].note.include?(Freya::HideGaugeText)
self.opacity = 0 if @battler.hp == 0 or hide
end
end
end
#==============================================================================
# ■ Sprite_Battler
#------------------------------------------------------------------------------
# 显示战斗者的精灵。根据 Game_Battler 类的实例自动变化。
#==============================================================================
class Sprite_Battler < Sprite_Base
#--------------------------------------------------------------------------
# ☆ 初始化对象
#--------------------------------------------------------------------------
alias initialize_freya_enemy_hp initialize
def initialize(viewport, battler = nil)
initialize_freya_enemy_hp(viewport, battler)
if @battler.is_a?(Game_Enemy)
@hp_gauge = Sprite_Battler_HP.new(viewport, battler)
end
end
#--------------------------------------------------------------------------
# ☆ 释放
#--------------------------------------------------------------------------
alias dispose_freya_enemy_hp dispose
def dispose
dispose_freya_enemy_hp
unless @hp_gauge.nil?
@hp_gauge.dispose
end
end
#--------------------------------------------------------------------------
# ☆ 更新画面
#--------------------------------------------------------------------------
alias update_freya_enemy_hp update
def update
update_freya_enemy_hp
@hp_gauge.update unless @hp_gauge.nil?
end
alias update_freya_position update_position
def update_position
update_freya_position
@hp_gauge.x = self.x - 48 unless @hp_gauge.nil?
@hp_gauge.y = self.y unless @hp_gauge.nil?
end
end
|
|