module RPG
class Weapon
#--------------------------------------------------------------------------
# ● アクション設定
#--------------------------------------------------------------------------
def battle_actions
case @id
when 1 # ブロンズソード
return BattleActions::Actions["通常攻撃"]
end
return BattleActions::Actions["通常攻撃"]
end
end
class Skill
#--------------------------------------------------------------------------
# ● アクション設定
#--------------------------------------------------------------------------
def battle_actions
if self.magic?
return BattleActions::Actions["術発動"]
else
return BattleActions::Actions["払い抜け"]
end
end
end
class Item
#--------------------------------------------------------------------------
# ● アクション設定
#--------------------------------------------------------------------------
def battle_actions
return BattleActions::Actions["アイテム使用"]
end
end
end
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● アクション設定
#--------------------------------------------------------------------------
def battle_actions
return BattleActions::Actions["エネミー攻撃"]
end
end
=begin
#--------------------------------------------------------------------------
# ● 遠距離アニメーション
#--------------------------------------------------------------------------
☆ 説明
=end
module RPG
class Weapon#★★★★★★★★★★★★★★★★★★★★★
#--------------------------------------------------------------------------
# ● 遠距離アニメーション(本来是远距动画的,现在当成给武器的属性吧)
#--------------------------------------------------------------------------
def flying_anime
case @id
when 7,23,105 #火
return [224,2,false,false]
when 39,53,89 #水
return [231,2,false,false]
when 5,38,54,88 #土
return [228,2,false,false]
when 22,87,117 #风
return [227,2,false,false]
when 8,25,57,101#雷
return [226,2,false,false]
when 9,37,102 #冰
return [225,2,false,false]
when 6,56,85,120 #光
return [229,2,false,false]
when 21,55,71,121 #暗
return [230,2,false,false]
end
return [0,0,false,false]
end
end
class Skill
#--------------------------------------------------------------------------
# ● 遠距離アニメーション(可以作为远距魔法)
#--------------------------------------------------------------------------
def flying_anime
#case @id
#when 132 # ブーメランっぽいやつ
# return [170,10,true,false]
# end
return [0,0,false,false]
end
end
class Item
#--------------------------------------------------------------------------
# ● 遠距離アニメーション(远距离道具,手榴弹??)
#--------------------------------------------------------------------------
def flying_anime
case @id
when 23
return [159,15,false,true]
when 73
return [192,15,false,true]
end
return [0,0,false,false]
end
end
end
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● 遠距離アニメーション
#--------------------------------------------------------------------------
def flying_anime
return [0,0,false,false]
end
end
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
include Side_view
#--------------------------------------------------------------------------
# ● 追加?公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :height # 画像の高さ
attr_accessor :real_x # X座標補正
attr_accessor :real_y # Y座標補正
attr_accessor :real_zoom # 拡大率
attr_accessor :wait_count # アニメーション 待ち時間
attr_accessor :wait_count2 # アニメーション 待ち時間2
attr_accessor :pattern # アニメーション カウント(キャラ)
attr_accessor :shake # シェイク開始フラッグ
attr_accessor :reverse # 左右反転フラッグ
attr_accessor :shadow # 残像フラッグ
attr_accessor :flash_flag # 閃きフラッグ
attr_reader :ox # X座標補正
attr_reader :oy # Y座標補正
attr_reader :flying_x # 遠距離アニメX座標
attr_reader :flying_y # 遠距離アニメY座標
attr_reader :flying_anime # 遠距離アニメ
attr_reader :animation1_on # 行動アニメ開始フラッグ
attr_reader :animation2_on # 対象アニメ開始フラッグ
#--------------------------------------------------------------------------
# ● デフォルトのアニメーション待ち時間を取得
#--------------------------------------------------------------------------
def animation_duration=(animation_duration)
@_animation_duration = animation_duration
end
#--------------------------------------------------------------------------
# ● バトル開始時のセットアップ
#--------------------------------------------------------------------------
def start_battle
@height = 0
@real_x = 0
@real_y = 0
@real_zoom = 1.0
@battler_condition = ""
@action = nil
@battle_actions = []
@battler_action = false
@step = 0
@anime_on = false
@wait_count = 0
@wait_count2 = 0
@ox = 0
@oy = 0
@pattern = 0
@pattern_log = true
@pattern_freeze = false
@condition_freeze = false
@active = false
@move_distance = nil
@move_wait = 0
@move_coordinates = [0,0,0,0]
@flying_distance = nil
@flying_wait = 0
@flying_x = 0
@flying_y = 0
@flash_flag = {}
self.flying_clear
end
#--------------------------------------------------------------------------
# ● 移動中判定
#--------------------------------------------------------------------------
def moving?
# X座標補正または、Y座標補正が0でなければ、移動中
return (@ox != 0 or @oy != 0)
end
#--------------------------------------------------------------------------
# ● 移動終了判定
#--------------------------------------------------------------------------
def move_end?
return (@ox == @move_coordinates[0] and @oy == @move_coordinates[1])
end
#--------------------------------------------------------------------------
# ● アクション開始設定
#--------------------------------------------------------------------------
def action(flag = true)
@battler_action = flag
@animation1_on = false
@animation2_on = false
@step = "setup"
end
#--------------------------------------------------------------------------
# ● アクション中判定
#--------------------------------------------------------------------------
def action?
return @battler_action
end
#--------------------------------------------------------------------------
# ● 閃き判定
#--------------------------------------------------------------------------
def flash?
return @flash_flg
end
#--------------------------------------------------------------------------
# ● 戦闘不能判定
#--------------------------------------------------------------------------
def anime_dead?
if $game_temp.in_battle and !RTAB
if [2,3,4,5].include?($scene.phase4_step)
return @last_dead
end
end
return @last_dead = self.dead?
end
#--------------------------------------------------------------------------
# ● ピンチ状態判定
#--------------------------------------------------------------------------
def crisis?
if $game_temp.in_battle and !RTAB
if [2,3,4,5].include?($scene.phase4_step)
return @last_crisis
end
end
return @last_crisis = (self.hp <= self.maxhp / 4 or badstate?)
end
#--------------------------------------------------------------------------
# ● バッドステート判定
#--------------------------------------------------------------------------
def badstate?
for i in @states
unless $data_states.nonresistance
return true
end
end
return false
end
#--------------------------------------------------------------------------
# ● 飛行
#--------------------------------------------------------------------------
def fly
if @fly != nil
return @fly
end
for id in @states
if FLY_STATES.include?($data_states[id].name)
return 60
end
end
return 0
end
#--------------------------------------------------------------------------
# ● 遠距離アニメ目標座標の計算
#--------------------------------------------------------------------------
def flying_setup
# 二度目は実行しない
return if @flying_distance != nil && !camera_correctness
if RTAB
targets = @target
else
targets = $scene.target_battlers
end
# 目的座標を計算
@f_target_x = 0
@f_target_y = 0
for t in targets
@f_target_x += t.screen_x
@f_target_y += t.screen_y
end
if targets != []
@f_target_x /= targets.size
@f_target_y /= targets.size
else
@flying_distance = 0
return
end
# 距離の計算
@flying_distance = (self.screen_x - @f_target_x).abs + (self.screen_y - @f_target_y).abs
end
#--------------------------------------------------------------------------
# ● 遠距離アニメ
#--------------------------------------------------------------------------
def flying_animation
# 戻る
if @step != "flying" or @flying_distance.nil?
return [false,true]
end
# あらかじめ計算
self_x = self.screen_x
self_y = self.screen_y
@flying_distance = @flying_distance == 0 ? 1 : @flying_distance
n1 = @flying_wait / @flying_distance.to_f
if @flying_distance - @flying_wait > @flying_distance / 2
n2 = 1.0 + 10.0 * @flying_wait / @flying_distance.to_f
else
n2 = 1.0 + 10.0 * (@flying_distance - @flying_wait) / @flying_distance.to_f
end
if !@flying_anime[4]
# 直線移動
x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
y = (self_y + 1.0 * (@f_target_y - self_y) * n1).to_i
else
# 曲線移動
if !@flying_proceed_end
x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
y = (self_y + 1.0 * (@f_target_y - self_y) * n1 - n2**2).to_i
else
x = (self_x + 1.0 * (@f_target_x - self_x) * n1).to_i
y = (self_y + 1.0 * (@f_target_y - self_y) * n1 + n2**2).to_i
end
end
# 座標代入
@flying_x = x
@flying_y = y
# ウエイト
if !@flying_proceed_end
# 開始
@flying_proceed_start = @flying_wait == 0
@flying_wait += @flying_anime[1]
@flying_wait = [@flying_wait,@flying_distance].min
@flying_proceed_end = @flying_wait == @flying_distance
else
# 開始
@flying_return_start = @flying_wait == @flying_distance
@flying_wait -= @flying_anime[1]
@flying_wait = [@flying_wait,0].max
@flying_return_end = @flying_wait == 0
end
if @flying_anime[1] == 0
@flying_end = true
elsif !@flying_anime[2]
@flying_end = @flying_proceed_end
else
@flying_end = @flying_return_end
end
# 値を返す(アニメ開始,アニメ終了)
return [@flying_proceed_start,@flying_end]
end
#--------------------------------------------------------------------------
# ● 遠距離アニメ初期化
#--------------------------------------------------------------------------
def flying_clear
@flying_proceed_start = false
@flying_proceed_end = false
@flying_return_start = false
@flying_return_end = false
@flying_end = false
@flying_anime = [0,0,false]
end
#--------------------------------------------------------------------------
# ● 移動
#--------------------------------------------------------------------------
def move
# 距離の計算
@move_distance = (@move_coordinates[2] - @move_coordinates[0]).abs +
(@move_coordinates[3] - @move_coordinates[1]).abs
if @move_distance > 0
return if @ox == @move_coordinates[0] and @oy == @move_coordinates[1]
array = @move_coordinates
# ジャンプ補正値の計算
if @move_distance - @move_wait > @move_distance / 2
jump = (@move_action[4] * @move_wait / @move_distance.to_f)**2
else
jump = (@move_action[4] * (@move_distance - @move_wait) / @move_distance.to_f)**2
end
jump = @move_action[4] > 0 ? -jump : jump
@ox = (array[2] + 1.0 * (array[0] - array[2]) * (@move_distance - @move_wait) / @move_distance.to_f).to_i
@oy = (array[3] + 1.0 * (array[1] - array[3]) * (@move_distance - @move_wait) / @move_distance.to_f + jump).to_i
# ウエイト
@move_wait -= @move_action[3]
@move_wait = [@move_wait,0].max
end
end
#--------------------------------------------------------------------------
# ● 移動アクションの取得
#--------------------------------------------------------------------------
def get_move_action
string = @action.split(/#/)[1]
string = string.split(/,/)
@move_action = [string[0],string[1].to_i,string[2].to_i,string[3].to_i,string[4].to_i,string[5].to_i]
end
#--------------------------------------------------------------------------
# ● アクションの取得
#--------------------------------------------------------------------------
def get_step
if @action.nil?
@step = "finish"
return
end
string = @action.split(/#/)[0]
if string =~ "移動"
@step = "moving_setup"
elsif string =~ "アクターアニメ実行"
@step = "action"
elsif string =~ "遠距離アニメ"
@step = "flying"
elsif string =~ "アクターアニメ変更"
@step = "change"
elsif string =~ "行動アニメ"
@step = "animation1"
elsif string =~ "対象アニメ"
@step = "animation2"
elsif string =~ "ウエイト"
@step = "wait"
elsif string =~ "左右反転"
@step = "reverse"
elsif string =~ "閃きアニメ"
@step = "flash"
elsif string =~ "残像表示"
@step = "shadow_on"
elsif string =~ "残像消去"
@step = "shadow_off"
elsif string =~ "アクターアニメ固定"
@step = "freeze"
elsif string =~ "アニメ固定解除"
@step = "freeze_lifting"
elsif string =~ "アニメーションの表示"
@step = "animation_start"
elsif string =~ "SEの演奏"
@step = "play_se"
else
@step = "finish"
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (次のアクションへ)
#--------------------------------------------------------------------------
def update_next
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (動作取得)
#--------------------------------------------------------------------------
def update_setup
# アクションの取得
self.get_actions
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (移動取得)
#--------------------------------------------------------------------------
def update_moving_setup
# 移動アクションの取得
self.get_move_action
# 移動目標の設定
self.move_setup
@step = "moving"
end
#--------------------------------------------------------------------------
# ● フレーム更新 (移動)
#--------------------------------------------------------------------------
def update_moving
# 移動
self.move
self.condition = @battler_condition
# 移動完了したら次のステップへ
if move_end?
@wait_count = 2
@action = @battle_actions.shift
@step = get_step
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アニメ実行)
#--------------------------------------------------------------------------
def update_action
con = @action.split(/#/)[1]
# 右手?左手を分ける
if DUAL_WEAPONS_ANIME.include?(con)
if !@first_weapon and @second_weapon
con = con + "_L"
else
con = con + "_R"
end
end
# アニメ変更
self.condition = con
# ループか否か
if !ANIME[@battler_condition][1]
self.anime_on
end
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (遠距離アニメ)
#--------------------------------------------------------------------------
def update_flying
# 目標の設定
self.flying_setup
# 遠距離アニメ終了
if @flying_end
self.flying_clear
@action = @battle_actions.shift
@step = get_step
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アニメ変更)
#--------------------------------------------------------------------------
def update_change
con = @action.split(/#/)[1]
# 右手?左手を分ける
if DUAL_WEAPONS_ANIME.include?(con)
if !@first_weapon and @second_weapon
con = con + "_L"
else
con = con + "_R"
end
end
# アニメ変更
self.condition = con
# ループか否か
if !ANIME[@battler_condition][1]
self.anime_on
end
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (行動アニメ)
#--------------------------------------------------------------------------
def update_animation1
@animation1_on = true
# 行動アニメの後に行動を開始する
if $scene.phase4_step == 3
id = RTAB ? @anime1 : $scene.animation1_id
animation = $data_animations[id]
frame_max = animation != nil ? animation.frame_max : 0
@wait_count2 = frame_max * 2
return
end
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (対象アニメ)
#--------------------------------------------------------------------------
def update_animation2
@animation2_on = true
# 行動アニメの後に行動を開始する
if $scene.phase4_step == 4
id = RTAB ? @anime2 : $scene.animation2_id
animation = $data_animations[id]
frame_max = animation != nil ? animation.frame_max : 0
@wait_count2 = frame_max * 2
return
end
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (ウエイト)
#--------------------------------------------------------------------------
def update_wait
@wait_count2 = @action.split(/#/)[1].to_i
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (残像表示)
#--------------------------------------------------------------------------
def update_shadow_on
@shadow = true
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (残像消去)
#--------------------------------------------------------------------------
def update_shadow_off
@shadow = false
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (左右反転)
#--------------------------------------------------------------------------
def update_reverse
@reverse = @reverse ? false : true
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (閃きアニメ)
#--------------------------------------------------------------------------
def update_flash
# 閃きアニメの後に行動を開始する
if @flash_flag["normal"]
@wait_count = $scene.flash_duration
@flash_flag["normal"] = false
return
end
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (SEの演奏)
#--------------------------------------------------------------------------
def update_play_se
data = @action.split(/#/)[1]
data = data.split(/,/)
# SE を演奏
Audio.se_play("Audio/SE/" + data[0], data[1].to_i, data[2].to_i)
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アクターアニメ固定)
#--------------------------------------------------------------------------
def update_freeze
con = @action.split(/#/)[1]
# 右手?左手を分ける
if DUAL_WEAPONS_ANIME.include?(con)
if !@first_weapon and @second_weapon
con = con + "_L"
else
con = con + "_R"
end
end
# アニメ変更
self.condition = con
@pattern = @action.split(/#/)[2].to_i
@pattern_freeze = true
@condition_freeze = true
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アクターアニメ固定解除)
#--------------------------------------------------------------------------
def update_freeze_lifting
@pattern_freeze = false
@condition_freeze = false
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アニメーションの表示)
#--------------------------------------------------------------------------
def update_animation_start
data = @action.split(/#/)[1]
data = data.split(/,/)
target = data[0]
animation_id = data[1].to_i
if RTAB
case target
when "self"
@animation.push([animation_id,true])
when "target"
for tar in @target
tar.animation.push([animation_id, true])
end
end
else
case target
when "self"
@animation_id = animation_id
@animation_hit = true
when "target"
for tar in $scene.target_battlers
tar.animation_id = animation_id
tar.animation_hit = true
end
end
end
@action = @battle_actions.shift
@step = get_step
end
#--------------------------------------------------------------------------
# ● フレーム更新 (動作終了)
#--------------------------------------------------------------------------
def update_finish
# 動作終了
@battler_action = false
@step = "setup"
end
#--------------------------------------------------------------------------
# ● バトラーの状態 変更(バトラーグラフィックのタイプ)
#--------------------------------------------------------------------------
def condition=(condition)
return if @condition_freeze
@battler_condition = condition
@wait_count = ANIME[condition][2]
end
#--------------------------------------------------------------------------
# ● バトラーの状態(バトラーグラフィックのタイプ)
#--------------------------------------------------------------------------
def condition
return @battler_condition
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ウェイト中の場合
if @wait_count > 0
return
end
# パターン更新
self.char_animation
# ウェイト中の場合
if @wait_count2 > 0
return
end
# 行動アニメーション
if @battler_action
method("update_" + @step).call
return
end
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
include Side_view
#--------------------------------------------------------------------------
# ● セットアップ
#--------------------------------------------------------------------------
alias side_view_setup setup
def setup(actor_id)
side_view_setup(actor_id)
start_battle
end
#--------------------------------------------------------------------------
# ● 二刀武器のID取得 ※エラー回避用
#--------------------------------------------------------------------------
def weapon2_id
return @weapon2_id != nil ? @weapon2_id : 0
end
#--------------------------------------------------------------------------
# ● X方向 ポジション 取得 (陣形スクリプト拡張用)
#--------------------------------------------------------------------------
def position
return $data_classes[@class_id].position
end
#--------------------------------------------------------------------------
# ● Y方向 ポジション 取得 (陣形スクリプト拡張用)
#--------------------------------------------------------------------------
def position2
return self.index
end
#--------------------------------------------------------------------------
# ● 武器アニメタイプ
#--------------------------------------------------------------------------
def weapon_anime_type(type)
file_name = weapon_anime_type0(type)
visible = weapon_anime_type1(type)
z = weapon_anime_type2(type)
return [file_name,visible,z]
end
# 武器アイコン取得
def weapon_anime_type0(type)
type = ANIME[type][5]
return weapon_anime1 if type == "右手"
return weapon_anime2 if type == "左手"
return nil
end
# 表示?非表示の取得
def weapon_anime_type1(type)
return ANIME[type][3]
end
# バトラーより上に表示するかどうか
def weapon_anime_type2(type)
type = ANIME[type][5]
return true if type == "左手"
return false
end
#--------------------------------------------------------------------------
# ● バトル画面 X 座標の取得(カメラ補正無し)
#--------------------------------------------------------------------------
def true_x
return PARTY_X + position * FORMATION_X + @ox
end
#--------------------------------------------------------------------------
# ● バトル画面 Y 座標の取得(カメラ補正無し)
#--------------------------------------------------------------------------
def true_y
# パーティ内の並び順から Y 座標を計算して返す
if self.index != nil
y = position2 * FORMATION_Y + PARTY_Y + @oy - @height / 2
return y
else
return 0
end
end
#--------------------------------------------------------------------------
# ● バトル画面 X 座標の取得
#--------------------------------------------------------------------------
def screen_x(true_x = self.true_x)
return 320 + (true_x - 320) * @real_zoom + @real_x
end
#--------------------------------------------------------------------------
# ● バトル画面 Y 座標の取得
#--------------------------------------------------------------------------
def screen_y(true_y = self.true_y)
return true_y * @real_zoom + @real_y
end
#--------------------------------------------------------------------------
# ● バトル画面 Z 座標の取得
#--------------------------------------------------------------------------
def screen_z
return screen_y + 1000
end
#--------------------------------------------------------------------------
# ● バトル画面 X 座標の取得(移動などしていない場合)
#--------------------------------------------------------------------------
def base_x
return 320 + (true_x - @ox - 320) * @real_zoom + @real_x
end
#--------------------------------------------------------------------------
# ● バトル画面 Y 座標の取得
#--------------------------------------------------------------------------
def base_y
return (true_y - @oy) * @real_zoom + @real_y
end
#--------------------------------------------------------------------------
# ● バトル画面 拡大率の取得
#--------------------------------------------------------------------------
def zoom
return ($scene.zoom_rate[1] - $scene.zoom_rate[0]) *
(true_x + @fly) / 480 + $scene.zoom_rate[0]
end
#--------------------------------------------------------------------------
# ● 攻撃用、バトル画面 X 座標の取得
#--------------------------------------------------------------------------
def attack_x(z)
return (320 - true_x) * z * 0.75
end
#--------------------------------------------------------------------------
# ● 攻撃用、バトル画面 Y 座標の取得
#--------------------------------------------------------------------------
def attack_y(z)
return (160 - (true_y + fly / 4) * z + @height * zoom * z / 2) * 0.75
end
#--------------------------------------------------------------------------
# ● 閃き待ち時間
#--------------------------------------------------------------------------
def flash_duration
return $scene.flash_duration
end
#--------------------------------------------------------------------------
# ● アニメーション取得
#--------------------------------------------------------------------------
def battle_actions1
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
end
#--------------------------------------------------------------------------
# ● アニメーション取得
#--------------------------------------------------------------------------
def battle_actions2
weapon = $data_weapons[@weapon2_id]
return weapon != nil ? weapon.battle_actions : BattleActions::Actions["通常攻撃"]
end
#--------------------------------------------------------------------------
# ● 武器アニメーション取得
#--------------------------------------------------------------------------
def weapon_anime1
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.icon_name : ""
end
#--------------------------------------------------------------------------
# ● 武器アニメーション取得
#--------------------------------------------------------------------------
def weapon_anime2
weapon = $data_weapons[@weapon2_id]
return weapon != nil ? weapon.icon_name : ""
end
#--------------------------------------------------------------------------
# ● 遠距離アニメーション取得
#--------------------------------------------------------------------------
def flying_anime1
weapon = $data_weapons[@weapon_id]
return weapon != nil ? weapon.flying_anime : [0,0,false,false]
end
#--------------------------------------------------------------------------
# ● 遠距離アニメーション取得
#--------------------------------------------------------------------------
def flying_anime2
weapon = $data_weapons[@weapon2_id]
return weapon != nil ? weapon.flying_anime : [0,0,false,false]
end
#--------------------------------------------------------------------------
# ● 移動目標座標の計算
#--------------------------------------------------------------------------
def move_setup
if RTAB
targets = @target
else
targets = $scene.target_battlers
end
case @move_action[0]
when "self" # 自分
@target_x = self.base_x
@target_y = self.base_y
when "target_near" # 一番近くのターゲット
targets.sort!{|a,b| a.screen_x<=>b.screen_x }
targets.reverse!
if targets != []
@target_x = targets[0].screen_x
@target_y = targets[0].screen_y
else
@target_x = self.base_x
@target_y = self.base_y
end
when "target_far" # 一番遠くのターゲット
targets.sort!{|a,b| a.screen_x<=>b.screen_x }
if targets != []
@target_x = targets[0].screen_x
@target_y = targets[0].screen_y
else
@target_x = self.base_x
@target_y = self.base_y
end
when "target" # ターゲット中央
@target_x = 0
@target_y = 0
for t in targets
@target_x += t.screen_x
@target_y += t.screen_y
end
if targets != []
@target_x /= targets.size
@target_y /= targets.size
end
when "troop" # "トループ中央"
@target_x = 0
@target_y = 0
for t in $game_troop.enemies
@target_x += t.screen_x
@target_y += t.screen_y
end
if $game_troop.enemies != []
@target_x /= $game_troop.enemies.size
@target_y /= $game_troop.enemies.size
end
when "party" # "パーティ中央"
@target_x = 0
@target_y = 0
for t in $game_party.actors
@target_x += t.screen_x
@target_y += t.screen_y
end
if $game_party.actors != []
@target_x /= $game_party.actors.size
@target_y /= $game_party.actors.size
end
when "screen" # "画面"
@target_x = self.base_x
@target_y = self.base_y
end
# 補正
@target_x += @move_action[1] - self.base_x
@target_y += @move_action[2] - self.base_y
# 移動目標の座標をセット
@move_coordinates = [@target_x.to_i,@target_y.to_i,@move_coordinates[0],@move_coordinates[1]]
# 距離の計算(ウエイトの設定)
@move_wait = (@move_coordinates[2] - @move_coordinates[0]).abs +
(@move_coordinates[3] - @move_coordinates[1]).abs
end
end
#==============================================================================
# ■ Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ● セットアップ
#--------------------------------------------------------------------------
alias side_view_initialize initialize
def initialize(troop_id, member_index)
side_view_initialize(troop_id, member_index)
start_battle
end
#--------------------------------------------------------------------------
# ● 移動
#--------------------------------------------------------------------------
def move
# 距離の計算
@move_distance = (@move_coordinates[2] - @move_coordinates[0]).abs +
(@move_coordinates[3] - @move_coordinates[1]).abs
if @move_distance > 0
return if @ox == @move_coordinates[0] and @oy == @move_coordinates[1]
array = @move_coordinates
# ジャンプ補正値の計算
if @move_distance - @move_wait > @move_distance / 2
jump = (@move_action[4] * @move_wait / @move_distance.to_f)**2
else
jump = (@move_action[4] * (@move_distance - @move_wait) / @move_distance.to_f)**2
end
jump = @move_action[4] > 0 ? -jump : jump
@ox = (array[2] + 1.0 * (array[0] - array[2]) * (@move_distance - @move_wait) / @move_distance.to_f).to_i
@oy = (array[3] + 1.0 * (array[1] - array[3]) * (@move_distance - @move_wait) / @move_distance.to_f + jump).to_i
# ウエイト
@move_wait -= @move_action[3]
@move_wait = [@move_wait,0].max
end
end
#--------------------------------------------------------------------------
# ● 移動目標座標の計算
#--------------------------------------------------------------------------
def move_setup
if RTAB
targets = @target
else
targets = $scene.target_battlers
end
case @move_action[0]
when "self" # 自分
@target_x = self.base_x
@target_y = self.base_y
when "target_near" # 一番近くのターゲット
targets.sort!{|a,b| a.screen_x<=>b.screen_x }
if targets != []
@target_x = targets[0].screen_x
@target_y = targets[0].screen_y
else
@target_x = self.base_x
@target_y = self.base_y
end
when "target_far" # 一番遠くのターゲット
targets.sort!{|a,b| a.screen_x<=>b.screen_x }
targets.reverse!
if targets != []
@target_x = targets[0].screen_x
@target_y = targets[0].screen_y
else
@target_x = self.base_x
@target_y = self.base_y
end
when "target" # ターゲット中央
@target_x = 0
@target_y = 0
for t in targets
@target_x += t.screen_x
@target_y += t.screen_y
end
if targets != []
@target_x /= targets.size
@target_y /= targets.size
end
when "party" # "トループ中央"
@target_x = 0
@target_y = 0
for t in $game_troop.enemies
@target_x += t.screen_x
@target_y += t.screen_y
end
if $game_troop.enemies != []
@target_x /= $game_troop.enemies.size
@target_y /= $game_troop.enemies.size
end
when "troop" # "パーティ中央"
@target_x = 0
@target_y = 0
for t in $game_party.actors
@target_x += t.screen_x
@target_y += t.screen_y
end
if $game_party.actors != []
@target_x /= $game_party.actors.size
@target_y /= $game_party.actors.size
end
when "screen" # "画面"
@target_x = self.base_x
@target_y = self.base_y
end
# 補正
@target_x -= @move_action[1] + self.base_x
@target_y -= @move_action[2] + self.base_y
# 移動目標の座標をセット
@move_coordinates = [@target_x.to_i,@target_y.to_i,@move_coordinates[0],@move_coordinates[1]]
# 距離の計算(ウエイトの設定)
@move_wait = (@move_coordinates[2] - @move_coordinates[0]).abs +
(@move_coordinates[3] - @move_coordinates[1]).abs
end
if RTAB
alias original_x true_x
alias original_y true_y
else
alias original_x screen_x
alias original_y screen_y
end
#--------------------------------------------------------------------------
# ● バトル画面 X 座標の取得(カメラ補正無し)
#--------------------------------------------------------------------------
def true_x
return original_x + @ox
end
#--------------------------------------------------------------------------
# ● バトル画面 Y 座標の取得(カメラ補正無し)
#--------------------------------------------------------------------------
def true_y
return original_y - @height / 2 + @oy
end
#--------------------------------------------------------------------------
# ● バトル画面 X 座標の取得
#--------------------------------------------------------------------------
def screen_x(true_x = self.true_x)
return true_x * @real_zoom + @real_x
end
#--------------------------------------------------------------------------
# ● バトル画面 Y 座標の取得
#--------------------------------------------------------------------------
def screen_y(true_y = self.true_y)
return true_y * @real_zoom + @real_y
end
#--------------------------------------------------------------------------
# ● バトル画面 X 座標の取得(移動などしていない場合)
#--------------------------------------------------------------------------
def base_x(true_x = self.true_x)
return (true_x - @ox) * @real_zoom + @real_x
end
#--------------------------------------------------------------------------
# ● バトル画面 Y 座標の取得(移動などしていない場合)
#--------------------------------------------------------------------------
def base_y(true_y = self.true_y)
return (true_y - @oy) * @real_zoom + @real_y
end
end
#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# ● アクターを加える
# actor_id : アクター ID
#--------------------------------------------------------------------------
alias side_view_add_actor add_actor
def add_actor(actor_id)
# アクターを取得
actor = $game_actors[actor_id]
# サイドビューデータの初期化
actor.start_battle
# 戻す
side_view_add_actor(actor_id)
end
end
#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
include Side_view
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_reader :phase # フェーズ
attr_reader :phase4_step # フェーズ4ステップ
attr_reader :active_battler # 対象の配列
attr_reader :target_battlers # 対象の配列
attr_reader :animation1_id # 行動アニメID
attr_reader :animation2_id # 対象アニメID
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
alias side_view_main main
def main
# バトラー初期化
for battler in $game_party.actors + $game_troop.enemies
battler.start_battle
end
# 戻す
side_view_main
end
#--------------------------------------------------------------------------
# ● 閃き判定
#--------------------------------------------------------------------------
def flash?
return @flash_flag ? true : false
end
#--------------------------------------------------------------------------
# ● 閃きアニメ待ち時間取得
#--------------------------------------------------------------------------
def flash_duration
animation = nil
if FLASH_ANIME
animation = $data_animations[FLASH_ANIMATION_ID]
end
return animation != nil ? animation.frame_max * 2 + 2 : 0
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
#--------------------------------------------------------------------------
alias side_view_update_phase4_step2 update_phase4_step2
def update_phase4_step2(*arg)
battler = convert_battler2(*arg)
battler.action
side_view_update_phase4_step2(*arg)
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
#--------------------------------------------------------------------------
alias side_view_update_phase4_step3 update_phase4_step3
def update_phase4_step3(*arg)
battler = convert_battler2(*arg)
return if !battler.animation1_on and battler.action? and !battler.flash?
if battler.flash? and FLASH_ANIME
battler.flash_flag["normal"] = true
end
side_view_update_phase4_step3(*arg)
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 4 : 対象側アニメーション)
#--------------------------------------------------------------------------
alias side_view_update_phase4_step4 update_phase4_step4
def update_phase4_step4(*arg)
battler = convert_battler2(*arg)
targets = RTAB ? battler.target : @target_battlers
return if !battler.animation2_on and battler.action?
side_view_update_phase4_step4(*arg)
for target in targets
if RTAB
value = nil
if target.damage_sp.include?(battler)
value = target.damage_sp[battler]
end
if target.damage.include?(battler)
if value == nil or value == "Miss"
value = target.damage[battler]
elsif value.is_a?(Numeric) && value > 0
value = target.damage[battler] == "Miss" ? value : target.damage[battler]
end
end
else
value = target.damage
end
if target.is_a?(Game_Actor)
# ダメージの場合
if value.is_a?(Numeric) && value > 0
# シェイクを開始
target.shake = true
end
elsif target.is_a?(Game_Enemy)
# ダメージの場合
if value.is_a?(Numeric) && value > 0
# シェイクを開始
target.shake = true
end
end
end
end
#--------------------------------------------------------------------------
# ● プレバトルフェーズ開始
#--------------------------------------------------------------------------
alias start_phase1_correct start_phase1
def start_phase1
# カメラの設定
# 元々フロントビュー向けの数値になっているため
@zoom_rate = [1.0, 1.0]
start_phase1_correct
end
#--------------------------------------------------------------------------
# ● アクターコマンドフェーズ開始
#--------------------------------------------------------------------------
alias start_phase3_correct start_phase3
def start_phase3
battler = convert_battler
start_phase3_correct
if RTAB
# カメラの設定
# 元々フロントビュー向けの数値になっているため
@camera = "command"
@spriteset.screen_target(0, 0, 1.0)
end
end
end
class Spriteset_Battle
include Side_view
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias side_veiw_initialize initialize
def initialize
side_veiw_initialize
# アクタースプライトを解放
for sprite in @actor_sprites
sprite.dispose
end
# アクタースプライトを作成
@actor_sprites = []
for i in 1..Party_max
@actor_sprites.push(Sprite_Battler.new(@viewport1))
end
update
end
#--------------------------------------------------------------------------
# ● 画面のスクロール
#--------------------------------------------------------------------------
if method_defined?("screen_scroll")
alias side_view_screen_scroll screen_scroll
def screen_scroll
side_view_screen_scroll
# アクターの位置補正
for actor in $game_party.actors
actor.real_x = @real_x
actor.real_y = @real_y
actor.real_zoom = @real_zoom
end
end
end
end
class Sprite < ::Sprite
#==========================================
# 修改说明:
# @flash_shake用来制作挨打时候跳跃
# @_damage 用来记录每次打击之后弹出数字
# @_total_damage 记录总伤害
# @_total_damage_duration 总伤害持续帧
#==========================================
#alias 66RPG_rainbow_initialize : initialize
def initialize(viewport = nil)
#66RPG_rainbow_initialize(viewport)
super(viewport)
@_whiten_duration = 0
@_appear_duration = 0
@_escape_duration = 0
@_collapse_duration = 0
@_damage_duration = 0
@_animation_duration = 0
@_blink = false
# 挨打时候跳跃
@flash_shake = 0
# 伤害记录数组
@_damage = []
# 总伤害数字
@_total_damage = 0
# 总伤害持续帧
@_total_damage_duration = 0
end
def damage(value, critical)
if value.is_a?(Numeric)
damage_string = value.abs.to_s
else
damage_string = value.to_s
end
bitmap = Bitmap.new(160, 48)
bitmap.font.name = "Arial Black"
bitmap.font.size = 32
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
#=======================================
# 修改:颜色
#=======================================
if value.is_a?(Numeric) and value < 0
bitmap.font.color.set(176, 255, 144)
else
bitmap.font.color.set(255, 55, 55)
end
bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
if critical
bitmap.font.size = 20
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
bitmap.font.color.set(255, 255, 255)
bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
end
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x
@_damage_sprite.y = self.y - self.oy / 2
@_damage_sprite.z = 3000
@_damage_duration = 40
#=======================================
# 修改:推入新的伤害
#=======================================
@_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
# 总伤害处理
make_total_damage(value)
end
#--------------------------------------------------------------------------
# ● 总伤害处理
#--------------------------------------------------------------------------
def make_total_damage(value)
if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE
@_total_damage += value
else
return
end
bitmap = Bitmap.new(300, 150)
bitmap.font.name = "Arial Black"
bitmap.font.size = 48
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(+2, 12+2, 160, 36, @_total_damage.abs.to_s, 1)
if @_total_damage < 0
bitmap.font.color.set(80, 255, 00)
else
bitmap.font.color.set(255, 140, 0)
end
bitmap.draw_text(0, 12, 160, 36, @_total_damage.abs.to_s, 1)
if @_total_damage_sprite.nil?
@_total_damage_sprite = ::Sprite.new(self.viewport)
@_total_damage_sprite.ox = 80
@_total_damage_sprite.oy = 20
@_total_damage_sprite.z = 3000
end
@_total_damage_sprite.bitmap = bitmap
@_total_damage_sprite.zoom_x = 1.5
@_total_damage_sprite.zoom_y = 1.5
@_total_damage_sprite.x = self.x
@_total_damage_sprite.y = self.y - self.oy / 2 - 64
@_total_damage_sprite.z = 3001
@_total_damage_duration = 80
end
def animation(animation, hit, battler_damage="", battler_critical=false)
dispose_animation
#=======================================
# 修改:记录伤害和critical
#=======================================
@battler_damage = battler_damage
@battler_critical = battler_critical
@_animation = animation
return if @_animation == nil
@_animation_hit = hit
@_animation_duration = @_animation.frame_max
animation_name = @_animation.animation_name
animation_hue = @_animation.animation_hue
bitmap = RPG::Cache.animation(animation_name, animation_hue)
#=======================================
# 修改:计算总闪光权限值
#=======================================
for timing in @_animation.timings
dontflash = true
quanzhong = animation_process_timing(timing, @_animation_hit)
@all_quanzhong += quanzhong
# 记录最后一次闪光
@_last_frame = timing.frame if quanzhong != 0
end
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
#=======================================
# 修改:行动方动画不显示伤害
#=======================================
if $scene.is_a?(Scene_Battle)
if $scene.animation1_id == @battler.animation_id
@battler_damage = ""
end
end
@_animation_sprites = []
if @_animation.position != 3 or not @@_animations.include?(animation)
for i in 0..15
sprite = ::Sprite.new(self.viewport)
sprite.bitmap = bitmap
sprite.visible = false
@_animation_sprites.push(sprite)
end
unless @@_animations.include?(animation)
@@_animations.push(animation)
end
end
update_animation
end
#=======================================
# 修改:更换清除伤害的算法,以防万一
# 本内容在脚本中没有使用过
#=======================================
def dispose_damage
for damage in @_damage.reverse
damage[0].bitmap.dispose
damage[0].dispose
@_damage.delete(damage)
end
@_total_damage = 0
@_last_frame = -1
if @_total_damage_sprite != nil
@_total_damage_duration = 0
@_total_damage_sprite.bitmap.dispose
@_total_damage_sprite.dispose
@_total_damage_sprite = nil
end
end
def dispose_animation
#=======================================
# 修改:清除记录的伤害,清除权重记录
#=======================================
@battler_damage = nil
@battler_critical = nil
@all_quanzhong = 1
@_total_damage = 0
@_last_frame = -1
if @_animation_sprites != nil
sprite = @_animation_sprites[0]
if sprite != nil
@@_reference_count[sprite.bitmap] -= 1
if @@_reference_count[sprite.bitmap] == 0
sprite.bitmap.dispose
end
end
for sprite in @_animation_sprites
sprite.dispose
end
@_animation_sprites = nil
@_animation = nil
end
end
def update
super
if @_whiten_duration > 0
@_whiten_duration -= 1
self.color.alpha = 128 - (16 - @_whiten_duration) * 10
end
if @_appear_duration > 0
@_appear_duration -= 1
self.opacity = (16 - @_appear_duration) * 16
end
if @_escape_duration > 0
@_escape_duration -= 1
self.opacity = 256 - (32 - @_escape_duration) * 10
end
if @_collapse_duration > 0
@_collapse_duration -= 1
self.opacity = 256 - (48 - @_collapse_duration) * 6
end
#=======================================
# 修改:更新算法,更新弹出
#=======================================
if @_damage_duration > 0
@_damage_duration -= 1
for damage in @_damage
damage[0].x = self.x + self.viewport.rect.x -
self.ox + self.src_rect.width / 2 +
(40 - damage[1]) * damage[3] / 10
damage[0].y -= damage[4]+damage[1]/10
damage[0].opacity = damage[1]*20
damage[1] -= 1
if damage[1]==0
damage[0].bitmap.dispose
damage[0].dispose
@_damage.delete(damage)
next
end
end
end
#=======================================
# 添加:弹出总伤害
#=======================================
if @_total_damage_duration > 0
@_total_damage_duration -= 1
@_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
if @_total_damage_sprite.zoom_x > 1.0
@_total_damage_sprite.zoom_x -= 0.05
end
if @_total_damage_sprite.zoom_y > 1.0
@_total_damage_sprite.zoom_y -= 0.05
end
@_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
if @_total_damage_duration <= 0
@_total_damage = 0
@_total_damage_duration = 0
@_total_damage_sprite.bitmap.dispose
@_total_damage_sprite.dispose
@_total_damage_sprite = nil
end
end
#=======================================
if @_animation != nil and (Graphics.frame_count % 2 == 0)
@_animation_duration -= 1
update_animation
end
if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
update_loop_animation
@_loop_animation_index += 1
@_loop_animation_index %= @_loop_animation.frame_max
end
if @_blink
@_blink_count = (@_blink_count + 1) % 32
if @_blink_count < 16
alpha = (16 - @_blink_count) * 6
else
alpha = (@_blink_count - 16) * 6
end
self.color.set(255, 255, 255, alpha)
end
@@_animations.clear
end
def update_animation
if @_animation_duration > 0
frame_index = @_animation.frame_max - @_animation_duration
cell_data = @_animation.frames[frame_index].cell_data
position = @_animation.position
animation_set_sprites(@_animation_sprites, cell_data, position)
#=======================================
# 修改:弹出伤害,权重计算
#=======================================
for timing in @_animation.timings
if timing.frame == frame_index
t = 1.0 * animation_process_timing(timing, @_animation_hit)
#p t,"当前权重", @all_quanzhong,"总权重"
if @battler_damage.is_a?(Numeric) and t != 0
t *= @battler_damage
t /= @all_quanzhong
#p t,"当前伤害",@battler_damage,"总伤害"
t = t.to_i
# 最后一次闪光的话,伤害修正
if frame_index == @_last_frame
@_total_damage = @battler_damage - t
end
#p t,@battler_damage,@all_quanzhong
damage(t,@battler_critical)
# 防止重复播放miss
elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
damage(@battler_damage,@battler_critical)
end
end
end
else
dispose_animation
end
end
#=======================================
# 修改:敌人跳跃的功能 + 添加返回数值`
#=======================================
def animation_process_timing(timing, hit)
dontflash = false
if (timing.condition == 0) or
(timing.condition == 1 and hit == true) or
(timing.condition == 2 and hit == false)
unless dontflash
if timing.se.name != ""
se = timing.se
Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
end
end
case timing.flash_scope
when 1
unless dontflash
self.flash(timing.flash_color, timing.flash_duration * 2)
if @_total_damage >0
@flash_shake_switch = true
@flash_shake = 10
end
end
return timing.flash_color.alpha * timing.flash_duration
when 2
unless dontflash
if self.viewport != nil
self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
return timing.flash_color.alpha * timing.flash_duration
end
end
when 3
unless dontflash
self.flash(nil, timing.flash_duration * 2)
end
return timing.flash_color.alpha * timing.flash_duration
end
end
return 0
end
end
#★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
class Skill
#--------------------------------------------------------------------------
# ● 魔法かどうかの判断
#--------------------------------------------------------------------------
def magic?
if @atk_f == 0
return true
else
return false
end
end
end
end
# アローカーソルの位置修正
class Arrow_Actor < Arrow_Base
include Side_view
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias side_view_update update
def update
side_view_update
# スプライトの座標を設定
if self.actor != nil && (self.x != self.actor.screen_x + ARROW_OX or self.y != self.actor.screen_y + ARROW_OY)
self.x = self.actor.screen_x + ARROW_OX
self.y = self.actor.screen_y + ARROW_OY
end
end
end
class Arrow_Enemy < Arrow_Base
include Side_view
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias side_view_update update
def update
side_view_update
# スプライトの座標を設定
if self.enemy != nil && self.y != self.enemy.screen_y + self.enemy.height/2
self.x = self.enemy.screen_x
self.y = self.enemy.screen_y + self.enemy.height/2
end
end
end