赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 360 |
最后登录 | 2020-5-5 |
在线时间 | 8 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 60
- 在线时间
- 8 小时
- 注册时间
- 2008-3-26
- 帖子
- 23
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
脚本:
- #==============================================================================
- # ■ 行走图横版战斗[Ver.1.0.1]
- #------------------------------------------------------------------------------
- module Battle_Formation
- #------------------------------------------------------------------------------
- FORM = {
- # 战斗位置 =>
- # [角色1x.y] [角色2x.y] [角色3x.y] [角色4x.y]
- 0 => [[460,130], [480, 170], [460, 210], [480, 250]]
- }
- #------------------------------------------------------------------------------
- end
- #==============================================================================
- # ■ Game_System
- #==============================================================================
- class Game_System
- attr_accessor :battle_formation # Formation ID
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias init_game_system initialize
- def initialize
- init_game_system
- @battle_formation = 0 # 初步形成
- end
- end
- #==============================================================================
- # ■ Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● 是Sprite的使用? [重新界定]
- #--------------------------------------------------------------------------
- def use_sprite?
- return true
- end
- #--------------------------------------------------------------------------
- # ● 战斗画面获取X坐标
- #--------------------------------------------------------------------------
- def screen_x
- return Battle_Formation::FORM[$game_system.battle_formation][self.index][0]
- end
- #--------------------------------------------------------------------------
- # ● 战斗画面获取Y坐标
- #--------------------------------------------------------------------------
- def screen_y
- return Battle_Formation::FORM[$game_system.battle_formation][self.index][1]
- end
- #--------------------------------------------------------------------------
- # ● 战斗画面获取z坐标
- #--------------------------------------------------------------------------
- def screen_z
- bitmap = Cache.character(self.character_name)
- # Height + Y Coordinates
- return screen_y + bitmap.height / 4
- end
- end
- #==============================================================================
- # ■ Game_Enemy
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # ● 战斗画面获取z坐标[重新界定]
- #--------------------------------------------------------------------------
- def screen_z
- bitmap = Cache.battler(self.battler_name, self.battler_hue)
- # Height + Y Coordinates
- return screen_y + bitmap.height
- end
- end
- #==============================================================================
- # ■ VX-RGSS2-6 サイドビュー战斗[Ver.1.0.1]
- #------------------------------------------------------------------------------
- # 战斗实况告知
- #==============================================================================
- #==============================================================================
- # ■ Scene_Battle
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ● 战斗开始进程
- #--------------------------------------------------------------------------
- alias process_battle_start_sideview process_battle_start
- def process_battle_start
- for battler in $game_party.members + $game_troop.members
- battler.move_mode = SideView::M_MODE_WAIT
- end
- process_battle_start_sideview
- end
- #--------------------------------------------------------------------------
- # ● 胜利进程
- #--------------------------------------------------------------------------
- alias process_victory_sideview process_victory
- def process_victory
- for actor in $game_party.members
- actor.move_mode = SideView::M_MODE_WIN
- end
- process_victory_sideview
- end
- #--------------------------------------------------------------------------
- # ● 等到活动控制完毕
- #--------------------------------------------------------------------------
- def wait_for_motion
- while @active_battler.motion_stop
- update_basic
- end
- end
- #--------------------------------------------------------------------------
- # ● 执行作战:攻击[重新界定]
- #--------------------------------------------------------------------------
- def execute_action_attack
- text = sprintf(Vocab::DoAttack, @active_battler.name)
- @message_window.add_instant_text(text)
- targets = @active_battler.action.make_targets
- #---Enemy attack sound reproduced.
- if @active_battler.is_a?(Game_Enemy)
- Sound.play_enemy_attack
- wait(15, true)
- end
- #--- Proximity (Going)
- SideView.set_target_point(@active_battler, targets[0])
- @active_battler.move_mode = SideView::M_MODE_ATK1
- @active_battler.motion_stop = true
- wait_for_motion
- #--- Attack
- wait(5)
- @active_battler.move_mode = SideView::M_MODE_ATK2
- #---
- display_attack_animation(targets)
- wait(20)
- for target in targets
- target.attack_effect(@active_battler)
- display_action_effects(target)
- end
- #--- Proximity (Return)
- @active_battler.move_mode = SideView::M_MODE_ATK3
- @active_battler.motion_stop = true
- wait_for_motion
- #---Wait
- for target in targets
- target.move_mode = SideView::M_MODE_WAIT
- end
- @active_battler.move_mode = SideView::M_MODE_WAIT
- #---
- end
- #--------------------------------------------------------------------------
- # ● 执行作战:技能[重新界定]
- #--------------------------------------------------------------------------
- def execute_action_skill
- skill = @active_battler.action.skill
- text = @active_battler.name + skill.message1
- @message_window.add_instant_text(text)
- unless skill.message2.empty?
- wait(10)
- @message_window.add_instant_text(skill.message2)
- end
- #--- Enemy attack sound reproduced.
- if @active_battler.is_a?(Game_Enemy)
- Sound.play_enemy_attack
- wait(15, true)
- end
- #--- Long distance attack.
- @active_battler.move_mode = SideView::M_MODE_MAGI
- #---
- targets = @active_battler.action.make_targets
- display_animation(targets, skill.animation_id)
- @active_battler.mp -= @active_battler.calc_mp_cost(skill)
- $game_temp.common_event_id = skill.common_event_id
- for target in targets
- target.skill_effect(@active_battler, skill)
- display_action_effects(target, skill)
- end
- #---Wait
- for target in targets
- target.move_mode = SideView::M_MODE_WAIT
- end
- @active_battler.move_mode = SideView::M_MODE_WAIT
- #---
- end
- #--------------------------------------------------------------------------
- # 执行作战:物品???[重新界定]
- #--------------------------------------------------------------------------
- def execute_action_item
- item = @active_battler.action.item
- text = sprintf(Vocab::UseItem, @active_battler.name, item.name)
- @message_window.add_instant_text(text)
- #--- Enemy attack sound reproduced.
- if @active_battler.is_a?(Game_Enemy)
- Sound.play_enemy_attack
- wait(15, true)
- end
- #--- Long distance attack
- @active_battler.move_mode = SideView::M_MODE_MAGI
- #---
- targets = @active_battler.action.make_targets
- display_animation(targets, item.animation_id)
- $game_party.consume_item(item)
- $game_temp.common_event_id = item.common_event_id
- for target in targets
- target.item_effect(@active_battler, item)
- display_action_effects(target, item)
- end
- #---Wait
- for target in targets
- target.move_mode = SideView::M_MODE_WAIT
- end
- @active_battler.move_mode = SideView::M_MODE_WAIT
- #---
- end
- #--------------------------------------------------------------------------
- # ● 攻击动画展示[重新界定]
- # 对象:对象的安排
- #--------------------------------------------------------------------------
- # 【改变一部分】
- # 敌人的声音效果是改变了,所以可以用在每一个阶段的运作情况。
- # 它改变了,所以这起攻击动画的一个敌人可以被显示出来。
- #--------------------------------------------------------------------------
- def display_attack_animation(targets)
- display_normal_animation(targets, @active_battler.atk_animation_id, false)
- display_normal_animation(targets, @active_battler.atk_animation_id2, true)
- wait_for_animation
- end
- #--------------------------------------------------------------------------
- # ● HP损害显示[重新界定]
- # 对象:候选人
- # 对象:技能,还是物品?
- #--------------------------------------------------------------------------
- def display_hp_damage(target, obj = nil)
- if target.hp_damage == 0 # 任何破坏
- return if obj != nil and obj.damage_to_mp
- return if obj != nil and obj.base_damage == 0
- fmt = target.actor? ? Vocab::ActorNoDamage : Vocab::EnemyNoDamage
- text = sprintf(fmt, target.name)
- elsif target.absorbed # 吸收
- fmt = target.actor? ? Vocab::ActorDrain : Vocab::EnemyDrain
- text = sprintf(fmt, target.name, Vocab::hp, target.hp_damage)
- elsif target.hp_damage > 0 # 损坏
- if target.actor?
- text = sprintf(Vocab::ActorDamage, target.name, target.hp_damage)
- Sound.play_actor_damage
- $game_troop.screen.start_shake(5, 5, 10)
- target.blink = true # Only adds here
- else
- text = sprintf(Vocab::EnemyDamage, target.name, target.hp_damage)
- Sound.play_enemy_damage
- target.blink = true
- end
- else # 回收
- fmt = target.actor? ? Vocab::ActorRecovery : Vocab::EnemyRecovery
- text = sprintf(fmt, target.name, Vocab::hp, -target.hp_damage)
- Sound.play_recovery
- end
- @message_window.add_instant_text(text)
- wait(30)
- end
- end
- #==============================================================================
- # ■ VX-RGSS2-6 サイドビュー战斗[Ver.1.0.1]
- #------------------------------------------------------------------------------
- module SideView
- #----------------------------------------------------------------------------
- #-----[运行格局]-----
- #运行速度
- MOTION_SPEED = 20
- #-----[アニメーション設定]-----
- # 通常敌人攻击动画设置
- E_ANIME = {
- # EnemyID => [Usually atttack and additional attack animations.]
- 1 => [1, 0]
- }
- #----------------------------------------------------------------------------
- #----------------------------------------------------------------------------
- # Motion Control Mode
- M_MODE_WAIT = 0 # Standby
- M_MODE_MAGI = 1 # Attack
- M_MODE_DAMG = 2 # Non-Damage Attack
- M_MODE_WIN = 3 # Victory
- M_MODE_ATK1 = 4 # Direct Attack (Approaching)
- M_MODE_ATK2 = 5 # Direct Attack (Attacking)
- M_MODE_ATK3 = 6 # Direct Attack (Returning)
- module_function
- #--------------------------------------------------------------------------
- # ● 活动区域计算
- #--------------------------------------------------------------------------
- def set_target_point(attacker, target)
- case target
- when Game_Actor
- bits = Cache.character(target.character_name)
- attacker.target_x = target.screen_x + (bits.width / 8)
- attacker.target_y = target.screen_y
- when Game_Enemy
- bits = Cache.battler(target.battler_name, target.battler_hue)
- attacker.target_x = target.screen_x + (bits.width / 2)
- attacker.target_y = target.screen_y
- end
- end
- end
- class Game_Battler
- attr_accessor :move_mode # Operation Mode
- # 0:Standby 1:Attack 2: Un-useless 3:Victory
- attr_accessor :motion_stop # Operation Stop Flag (Under Movement Flag)
- attr_accessor :target_x # Move Position(x)
- attr_accessor :target_y # Move Position(y)
- #--------------------------------------------------------------------------
- # ● 对象初始化
- #--------------------------------------------------------------------------
- alias initialize_sdva_corpse initialize
- def initialize
- initialize_sdva_corpse
- @move_mode = 0
- @motion_stop = false
- @target_x = 0
- @target_y = 0
- end
- end
- #==============================================================================
- # ■ Game_Enemy
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # ● 攻击动画ID采集
- #--------------------------------------------------------------------------
- def atk_animation_id
- return 0 if SideView::E_ANIME[@enemy_id].nil?
- return SideView::E_ANIME[@enemy_id][0]
- end
- #--------------------------------------------------------------------------
- # ● 攻击动画ID采集( 2剑式: 2武器)
- #--------------------------------------------------------------------------
- def atk_animation_id2
- return 0 if SideView::E_ANIME[@enemy_id].nil?
- return SideView::E_ANIME[@enemy_id][1]
- end
- end
- #==============================================================================
- # ■ Sprite_Battler
- #==============================================================================
- class Sprite_Battler < Sprite_Base
- #--------------------------------------------------------------------------
- # ● Object Initialization
- # Viewport : View Port
- # Battler : Battler (Game_Battler)
- #--------------------------------------------------------------------------
- alias initialize_sideview initialize
- def initialize(viewport, battler = nil)
- initialize_sideview(viewport, battler)
- init_direct_attack
- end
- #--------------------------------------------------------------------------
- # ● 一套价值接近攻击
- #--------------------------------------------------------------------------
- def init_direct_attack
- @direct_attack_cnt = 0
- @direct_attack_phase = 0
- @direct_move_cnt = 0
- @battler_x_plus = 0
- @battler_y_plus = 0
- @moving_mode = 0
- @pattern = 0
- @direction = 0
- end
- #--------------------------------------------------------------------------
- # ● 帧重建[重新界定]
- #--------------------------------------------------------------------------
- def update
- super
- if @battler == nil
- self.bitmap = nil
- else
- @use_sprite = @battler.use_sprite?
- if @use_sprite
- self.x = @battler.screen_x + @battler_x_plus
- self.y = @battler.screen_y + @battler_y_plus
- self.z = @battler.screen_z
- update_battler_bitmap
- end
- setup_new_effect
- update_effect
- end
- end
- #--------------------------------------------------------------------------
- # ● 点阵图转让源重建
- #--------------------------------------------------------------------------
- alias update_battler_bitmap_sideview update_battler_bitmap
- def update_battler_bitmap
- case @battler
- when Game_Actor
- if @battler.character_name != @battler_name or
- @battler.character_index != @battler_hue
- @battler_name = @battler.character_name
- @battler_hue = @battler.character_index
- draw_pre_character
- draw_character
- if (@battler.dead? or @battler.hidden)
- self.opacity = 0
- end
- end
- when Game_Enemy
- if @battler.battler_name != @battler_name or
- @battler.battler_hue != @battler_hue
- @battler_name = @battler.battler_name
- @battler_hue = @battler.battler_hue
- draw_battler
- if (@battler.dead? or @battler.hidden)
- self.opacity = 0
- end
- end
- end
- motion_control
- end
- #--------------------------------------------------------------------------
- # ● battler制图
- #--------------------------------------------------------------------------
- def draw_battler
- self.bitmap = Cache.battler(@battler_name, @battler_hue)
- @width = bitmap.width
- @height = bitmap.height
- self.ox = @width / 2
- self.oy = @height
- end
- #--------------------------------------------------------------------------
- # ● 预字制图[普通]
- #--------------------------------------------------------------------------
- def draw_pre_character
- self.bitmap = Cache.character(@battler_name)
- sign = @battler_name[/^[\!\$]./]
- if sign != nil and sign.include?('$')
- @width = bitmap.width / 3
- @height = bitmap.height / 4
- else
- @width = bitmap.width / 12
- @height = bitmap.height / 8
- end
- self.ox = @width / 2
- self.oy = @height
- end
- #--------------------------------------------------------------------------
- # ● 性格绘画[普通]
- #--------------------------------------------------------------------------
- def draw_character
- index = @battler_hue
- pattern = @pattern < 3 ? @pattern : 1
- sx = (index % 4 * 3 + pattern) * @width
- sy = (index / 4 * 4 + (@direction - 2) / 2) * @height
- self.src_rect.set(sx, sy, @width, @height)
- end
- #--------------------------------------------------------------------------
- # ● 活动控制
- #--------------------------------------------------------------------------
- def motion_control
- # Memory Operation Mode
- @moving_mode = @battler.move_mode
- # Battler Drawing
- case @battler
- when Game_Actor # Actor
- actor_motion_control
- when Game_Enemy # Enemy
- enemy_motion_control
- end
- end
- #--------------------------------------------------------------------------
- # ● 运动控制(角色)
- #--------------------------------------------------------------------------
- def actor_motion_control
- # Operation Change
- case @moving_mode
- when SideView::M_MODE_WAIT # Standby
- init_direct_attack
- @battler_x_plus = 0
- @direction = 4
- @pattern = 1
- when SideView::M_MODE_MAGI # Attack
- @battler_x_plus = -10
- @direction = 4
- @pattern = 3
- when SideView::M_MODE_DAMG # Non-Damage Attack
- @battler_x_plus = 10
- @direction = 4
- @pattern = 3
- when SideView::M_MODE_WIN # Victory
- @direction = 2
- @pattern = 1
- when SideView::M_MODE_ATK1 # Direct Attack (Approaching)
- exe_moving_attack_start
- @end_pos_x = @battler_x_plus
- when SideView::M_MODE_ATK2 # Direct Attack (Attacking)
- @battler_x_plus = @end_pos_x - 10
- when SideView::M_MODE_ATK3 # Direct Attack (Returning)
- exe_moving_attack_end
- else
- p "error:Sprite_Battler>> @moving_mode"
- end
- draw_character
- end
- #--------------------------------------------------------------------------
- # ● 运动控制(敌人)
- #--------------------------------------------------------------------------
- def enemy_motion_control
- # Operation Change
- case @moving_mode
- when SideView::M_MODE_WAIT # Standby
- init_direct_attack
- when SideView::M_MODE_MAGI # Attack
- @battler_x_plus = 10
- when SideView::M_MODE_DAMG # Non-Damage Attack
- @battler_x_plus = -10
- @shake_flg = true
- when SideView::M_MODE_ATK1 # Direct Attack (Approaching)
- exe_moving_attack_start
- @end_pos_x = @battler_x_plus
- when SideView::M_MODE_ATK2 # Direct Attack (Attacking)
- @battler_x_plus = @end_pos_x + 10
- when SideView::M_MODE_ATK3 # Direct Attack (Returning)
- exe_moving_attack_end
- else
- p "error:Sprite_Battler>> @moving_mode", @moving_mode
- end
- end
- #--------------------------------------------------------------------------
- # ● 接近攻击执行方法
- #--------------------------------------------------------------------------
- def exe_moving_attack_start
- return unless @battler.motion_stop
- case @direct_attack_phase
- when 0 # Start Operation Preparation
- diratk_start
- when 1 # Move Operation (Going)
- diratk_move
- when 2 # After-Movement Wait
- diratk_wait
- end
- end
- def exe_moving_attack_end
- case @direct_attack_phase
- when 0 # Attack Operation
- diratk_attack
- when 1 # Move Operation (Return)
- diratk_back
- when 2 # Operation End
- diratk_end
- end
- end
- #--------------------------------------------------------------------------
- # ● 接近攻击执行[开始运作准备]
- #--------------------------------------------------------------------------
- def diratk_start
- # Pose Change
- @pattern = 1
- # The number of frames needed is the distance between current position and
- # target position.
- pos_x = @battler.target_x - self.x
- pos_y = @battler.target_y - self.y
- # Caculation for ammount of frames needed.
- @direct_move_cnt = @direct_attack_cnt = (pos_x.abs / SideView::MOTION_SPEED).round
- # NEXT Phase
- @direct_attack_phase += 1
- end
- #--------------------------------------------------------------------------
- # ● 接近攻击执行[移到对象(去) ]
- #--------------------------------------------------------------------------
- def diratk_move
- case @battler
- when Game_Actor
- x_plus = @width
- y_plus = -@height / 4
- when Game_Enemy
- x_plus = -@width - 10
- y_plus = @height / 4
- end
- # The next movement location is figured out by the distance between
- # current position and target position.
- pos_x = @battler.target_x - self.x + x_plus
- pos_y = @battler.target_y - self.y + y_plus
- @battler_x_plus += pos_x / @direct_attack_cnt if @direct_attack_cnt != 0
- @battler_y_plus += pos_y / @direct_attack_cnt if @direct_attack_cnt != 0
- # End count
- @direct_attack_cnt -= 1
- # Last movement (Insurance: Last correction)
- if @direct_attack_cnt <= 0
- @battler_x_plus = @battler.target_x - @battler.screen_x + x_plus
- @battler_y_plus = @battler.target_y - @battler.screen_y + y_plus
- # NEXTフェーズ
- @direct_attack_cnt = 5
- @direct_attack_phase += 1
- end
- end
- #--------------------------------------------------------------------------
- # ● 接近攻击执行[攻击行动回报]
- #--------------------------------------------------------------------------
- def diratk_wait
- # End Count
- @direct_attack_cnt -= 1
- # Last Movement
- if @direct_attack_cnt <= 0
- # Pose Change
- @pattern = 3
- # END Phase
- @direct_attack_phase = 0
- @battler.motion_stop = false
- end
- end
- #--------------------------------------------------------------------------
- # ● 接近攻击执行[攻击行动回报]
- #--------------------------------------------------------------------------
- def diratk_attack
- # Pose Change
- @pattern = 1
- # End Wait Count
- @direct_attack_cnt = @direct_move_cnt
- # NEXT Phase
- @direct_attack_phase += 1
- end
- #--------------------------------------------------------------------------
- # ● 接近攻击执行[移到运行(往返) ]
- #--------------------------------------------------------------------------
- def diratk_back
- # The next movement location is figured out by the distance between
- # current position and target position.
- pos_x = @battler.screen_x - self.x
- pos_y = @battler.screen_y - self.y
- @battler_x_plus += pos_x / @direct_attack_cnt if @direct_attack_cnt != 0
- @battler_y_plus += pos_y / @direct_attack_cnt if @direct_attack_cnt != 0
- # End Count
- @direct_attack_cnt -= 1
- # Last Movement
- if @direct_attack_cnt == 0
- @battler_x_plus = 0
- @battler_y_plus = 0
- # NEXT Phase
- @direct_attack_phase += 1
- end
- end
- #--------------------------------------------------------------------------
- # ● 接近攻击执行[运行完]
- #--------------------------------------------------------------------------
- def diratk_end
- init_direct_attack
- @battler.motion_stop = false
- # END Phase
- @direct_attack_phase = 0
- end
- end
复制代码
敌人移动攻击的时候,会移到主角的后面,怎么办?应该在前面才对,求达人帮忙! 本贴由论坛斑竹火鸡三毛老大结贴,如楼主认为问题未解决,请重新将此贴编辑为“有事请教”,并回帖叙述疑点即可~ ^-^ |
|