设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2065|回复: 8
打印 上一主题 下一主题

[已经解决] 全动画战斗动画Z值的问题,请高手帮忙,我都快崩溃了!!

[复制链接]

Lv3.寻梦者

梦石
0
星屑
3176
在线时间
1442 小时
注册时间
2009-7-27
帖子
1454
跳转到指定楼层
1
发表于 2015-5-30 16:22:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x


我觉得全动画战斗脚本的作者做这个脚本应该是给45°战斗用的,因为45°战斗一般不会角色需要贴着角色,但是横版不一样……这是这个脚本的一大遗憾……
除了待机动画好好的,其他动画都发神经了,我都不知道从何下手了,都快崩溃了,整个人都思密达 了!!请高手帮我解决这个难题,感激不尽!希望还可以注释具体修改了哪里,以便我自行修改。
以下是主站上的全动画战斗脚本。
  1. #==============================================================================
  2. # ■ 全动画战斗
  3. #------------------------------------------------------------------------------
  4. #  By whbm
  5. #   应用脚本 彩虹神剑 By 66
  6. #==============================================================================

  7. #==============================================================================
  8. #简要介绍:
  9. #    本脚本实现了战斗的动态效果,其中包含了待机、攻击、防御、挨打、胜利、死亡。类似于超级横版、超级战斗。但是本系统特色在于所有效果的实现并不是靠庞大的战斗图,而是使用了数据库中的动画。这样不仅突破了不同人不同祯数量的限制,并且方便了单动画单祯的修改。
  10. #使用方法:
  11. #    个人觉得还是比较简单,但是大量的怪物还是会令人头痛。
  12. #    1.数据库的设置
  13. #      敌人必要的动画有待机、挨打、死亡三个必要的动画
  14. #      角色必要的动画有待机、挨打、防御、死亡动态、胜利动态、死亡静态、胜利静态
  15. #
  16. #      死亡静态与胜利静态:动画中只有1祯,为相应动态动画的最后一祯
  17. #      
  18. #      剩下的就是人物攻击的动画,和正常的动画是一样设置
  19. #      如图中的攻击等待动画只是为了在播放攻击动画的同时消除人物本身(素材原因,人物攻击的时候离开了原位,如果是在原位置放魔法是用不上的)
  20. #    2.战斗图的设置
  21. #      战斗图其实只是一个透明的图片,它只是用来描述一个敌人或者角色的大小,并与相应的战斗动画编号相衔接。
  22. #      战斗图的文件名格式如下:
  23. #          名字★待机★防御★挨打★死亡动态★死亡静态★胜利动态★胜利静态.png
  24. #          (其中“名字”一项与动画无关)
  25. #          例如:
  26. #          紫烟★140★141★148★149★150★144★145.png
  27. #      对于敌人无胜利动画或者防御动画,请保持该位置为空,例如:
  28. #          蓝若冰★124★★126★127★★★.png
  29. #    综上,设置就这么完成了。
  30. #注意事项:
  31. #    1.由于系统中待机由动画实现,所以无法使用状态附带动画的功能。
  32. #    2.可以在脚本中使用Ctrl+Shift+F通篇搜索“小改动”,可以修改某些窗口的Z值。
  33. #    3.当您将此系统向您的工程中移植的时候也要注意事项2中的“小改动”。
  34. #    4.系统是从游戏“石焚刃暖”中提取出来的,或许会有疏漏与多余的东西,BUG也是不免的。大家尽管提便是。   


  35. #全脚本查找@phase = 5,在下面插入以下语句:
  36. # 胜利动画
  37. # @spriteset.win
  38. #==============================================================================
  39. class Spriteset_Battle
  40.   #--------------------------------------------------------------------------
  41.   # ● 初始化变量
  42.   #--------------------------------------------------------------------------
  43.   def initialize
  44.     # 生成显示端口
  45.     @viewport1 = Viewport.new(0, 0, 640, 480)
  46.     @viewport2 = Viewport.new(0, 0, 640, 480)
  47.     @viewport3 = Viewport.new(0, 0, 640, 480)
  48.     @viewport4 = Viewport.new(0, 0, 640, 480)
  49.     @viewport2.z = 101
  50.     @viewport3.z = 200
  51.     @viewport4.z = 5000
  52.     # 生成战斗背景活动块
  53.     @battleback_sprite = Sprite.new(@viewport1)
  54.     # 生成敌人活动块
  55.     @enemy_sprites = []
  56.     for enemy in $game_troop.enemies.reverse
  57.       @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  58.     end
  59.     # 生成敌人活动块
  60.     @actor_sprites = []
  61.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  62.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  63.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  64.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  65.     # 生成天候
  66.     @weather = RPG::Weather.new(@viewport1)
  67.     # 生成图片活动块
  68.     @picture_sprites = []
  69.     for i in 51..100
  70.       @picture_sprites.push(Sprite_Picture.new(@viewport3,
  71.         $game_screen.pictures[i]))
  72.     end
  73.     # 生成计时器块
  74.     @timer_sprite = Sprite_Timer.new
  75.     # 刷新画面
  76.     update
  77.   end
  78.   #..........................................................................
  79.   #--------------------------------------------------------------------------
  80.   # ● 胜利图
  81.   #--------------------------------------------------------------------------
  82.   def win
  83.     for sprite in @actor_sprites
  84.       sprite.win
  85.     end
  86.   end
  87.   #..........................................................................
  88.   #--------------------------------------------------------------------------
  89.   # ● 刷新画面
  90.   #--------------------------------------------------------------------------
  91.   def update
  92.     # 刷新角色的活动块 (对应角色的替换)
  93.     @actor_sprites[0].battler = $game_party.actors[0]
  94.     @actor_sprites[1].battler = $game_party.actors[1]
  95.     @actor_sprites[2].battler = $game_party.actors[2]
  96.     @actor_sprites[3].battler = $game_party.actors[3]
  97.     # 战斗背景的文件名与现在情况有差异的情况下
  98.     if @battleback_name != $game_temp.battleback_name
  99.       @battleback_name = $game_temp.battleback_name
  100.       if @battleback_sprite.bitmap != nil
  101.         @battleback_sprite.bitmap.dispose
  102.       end
  103.       @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
  104.       @battleback_sprite.src_rect.set(0, 0, 640, 480)
  105.     end
  106.     # 刷新战斗者的活动块
  107.     for sprite in @enemy_sprites + @actor_sprites
  108.       sprite.update
  109.     end
  110.     # 刷新天气图形
  111.     @weather.type = $game_screen.weather_type
  112.     @weather.max = $game_screen.weather_max
  113.     @weather.update
  114.     # 刷新图片活动块
  115.     for sprite in @picture_sprites
  116.       sprite.update
  117.     end
  118.     # 刷新计时器活动块
  119.     @timer_sprite.update
  120.     # 设置画面的色调与震动位置
  121.     @viewport1.tone = $game_screen.tone
  122.     @viewport1.ox = $game_screen.shake
  123.     # 设置画面的闪烁色
  124.     @viewport4.color = $game_screen.flash_color
  125.     # 刷新显示端口
  126.     @viewport1.update
  127.     @viewport2.update
  128.     @viewport4.update
  129.   end
  130. end
  131. class Arrow_Enemy < Arrow_Base
  132.   #--------------------------------------------------------------------------
  133.   # ● 获取光标指向的敌人
  134.   #--------------------------------------------------------------------------
  135.   def enemy
  136.     return $game_troop.enemies[@index]
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ● 刷新画面
  140.   #--------------------------------------------------------------------------
  141.   def update
  142.     super
  143.     # 如果指向不存在的敌人就离开
  144.     $game_troop.enemies.size.times do
  145.       break if self.enemy.exist?
  146.       @index += 1
  147.       @index %= $game_troop.enemies.size
  148.     end
  149.     # 光标右
  150.     if Input.repeat?(Input::RIGHT)
  151.       $game_system.se_play($data_system.cursor_se)
  152.       $game_troop.enemies.size.times do
  153.         @index += 1
  154.         @index %= $game_troop.enemies.size
  155.         break if self.enemy.exist?
  156.       end
  157.     end
  158.     # 光标左
  159.     if Input.repeat?(Input::LEFT)
  160.       $game_system.se_play($data_system.cursor_se)
  161.       $game_troop.enemies.size.times do
  162.         @index += $game_troop.enemies.size - 1
  163.         @index %= $game_troop.enemies.size
  164.         break if self.enemy.exist?
  165.       end
  166.     end
  167.     # 设置活动块坐标
  168.     if self.enemy != nil
  169.       self.x = self.enemy.screen_x + self.ox
  170.       self.y = self.enemy.screen_y + self.oy
  171.     end
  172.   end
  173. end
  174. class Arrow_Actor < Arrow_Base
  175.   #--------------------------------------------------------------------------
  176.   # ● 获取光标指向的角色
  177.   #--------------------------------------------------------------------------
  178.   def actor
  179.     return $game_party.actors[@index]
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ● 刷新画面
  183.   #--------------------------------------------------------------------------
  184.   def update
  185.     super
  186.     # 光标右
  187.     if Input.repeat?(Input::RIGHT)
  188.       $game_system.se_play($data_system.cursor_se)
  189.       @index += 1
  190.       @index %= $game_party.actors.size
  191.     end
  192.     # 光标左
  193.     if Input.repeat?(Input::LEFT)
  194.       $game_system.se_play($data_system.cursor_se)
  195.       @index += $game_party.actors.size - 1
  196.       @index %= $game_party.actors.size
  197.     end
  198.     # 设置活动块坐标
  199.     if self.actor != nil
  200.       self.x = self.actor.screen_x + self.ox
  201.       self.y = self.actor.screen_y + self.oy
  202.     end
  203.   end
  204. end
  205. class Scene_Battle
  206.   #--------------------------------------------------------------------------
  207.   # ● 刷新画面 (主回合步骤 3 : 行动方动画)
  208.   #--------------------------------------------------------------------------
  209.   def update_phase4_step3
  210.     # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  211.     if @animation1_id == 0
  212.       @active_battler.white_flash = true
  213.     else
  214.       @active_battler.animation_id = @animation1_id
  215.       @active_battler.animation_hit = true
  216.     end
  217.     # 对像方动画
  218.     for target in @target_battlers
  219.       target.animation_id = @animation2_id
  220.       target.animation_hit = (target.damage != "Miss")
  221.       #.......................................................................
  222.       if target.is_a?(Game_Actor)
  223.         if target.current_action.kind == 0 and target.current_action.basic == 1
  224.           target.setup_battler_ani(target.battler_name.split(/★/)[2])
  225.         else
  226.           target.setup_battler_hurt_ani(0)
  227.         end
  228.       end
  229.       if target.is_a?(Game_Enemy)
  230.         if target.current_action.kind == 0 and target.current_action.basic == 1
  231.           target.setup_battler_ani(target.battler_name.split(/★/)[1])
  232.         else
  233.           target.setup_battler_hurt_ani(0)
  234.         end
  235.       end
  236.       #.......................................................................
  237.     end
  238.     # 对像方动画
  239.     for target in @target_battlers
  240.       target.animation_id = @animation2_id
  241.       target.animation_hit = (target.damage != "Miss")
  242.       #......................................................................
  243.     end
  244.     # 限制动画长度、最低 8 帧
  245.     @wait_count = 8
  246.     # 移至步骤 5
  247.     @phase4_step = 5
  248.   end
  249.   #--------------------------------------------------------------------------
  250.   # ● 刷新画面 (主回合步骤 4 : 对像方动画) ★
  251.   #--------------------------------------------------------------------------
  252.   def update_phase4_step4
  253.     # 限制动画长度、最低 8 帧
  254.     @wait_count = 8
  255.     # 移至步骤 5
  256.     @phase4_step = 5
  257.   end
  258. end

  259. class Scene_Battle
  260.   #..........................................................................
  261.   #--------------------------------------------------------------------------
  262.   # ● 返回phase
  263.   #--------------------------------------------------------------------------
  264.   def phase
  265.     return @phase
  266.   end
  267.   #--------------------------------------------------------------------------
  268.   # ● 返回phase4_step
  269.   #--------------------------------------------------------------------------
  270.   def phase4_step
  271.     return @phase4_step
  272.   end
  273.   #--------------------------------------------------------------------------
  274.   # ● 返回phase4_step
  275.   #--------------------------------------------------------------------------
  276.   def actor_command_active?
  277.     return @actor_command_window.active
  278.   end
  279.   #..........................................................................
  280. end
  281. class Game_Battler
  282.   #..........................................................................
  283.   #--------------------------------------------------------------------------
  284.   # ● 获取循环的动画 ID
  285.   #--------------------------------------------------------------------------  
  286.   def show_damage(value)
  287.     @show_damage_value = value
  288.   end
  289.   #--------------------------------------------------------------------------
  290.   # ● 获取循环的动画 ID
  291.   #--------------------------------------------------------------------------
  292.   def show_damage_value
  293.     return @show_damage_value
  294.   end
  295.   #--------------------------------------------------------------------------
  296.   # ● 获取循环的动画 ID
  297.   #--------------------------------------------------------------------------
  298.   def battler_ani
  299.     return @battler_ani
  300.   end
  301.   #--------------------------------------------------------------------------
  302.   # ● 获取循环的动画 ID
  303.   #--------------------------------------------------------------------------
  304.   def setup_battler_ani(battler_ani, once = 0)
  305.     @battler_ani = battler_ani
  306.     @once = once
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   # ● 获取循环的动画 ID
  310.   #--------------------------------------------------------------------------
  311.   def setup_battler_hurt_ani(hurt)
  312.     @hurt = hurt
  313.   end  
  314.   #--------------------------------------------------------------------------
  315.   # ● 获取循环的动画 ID
  316.   #--------------------------------------------------------------------------
  317.   def setup_battler_dead_ani(over)
  318.     @over = over
  319.   end
  320.   #--------------------------------------------------------------------------
  321.   # ● 获取循环的动画 ID
  322.   #--------------------------------------------------------------------------
  323.   def battler_dead_ani
  324.     return @over
  325.   end
  326.   #--------------------------------------------------------------------------
  327.   # ● 获取循环的动画 ID
  328.   #--------------------------------------------------------------------------
  329.   def battler_ani_once
  330.     return @once
  331.   end
  332.   #--------------------------------------------------------------------------
  333.   # ● 获取循环的动画 ID
  334.   #--------------------------------------------------------------------------
  335.   def battler_hurt_ani
  336.     return @hurt
  337.   end
  338.   #..........................................................................
  339. end
  340. class Sprite_Battler < RPG::Sprite
  341.   #..........................................................................
  342.   #--------------------------------------------------------------------------
  343.   # ● 胜利图
  344.   #--------------------------------------------------------------------------
  345.   def win
  346.     if @battler_name != nil and not @battler.hidden and not @battler.dead?
  347.       @battler.setup_battler_ani(@battler_name.split(/★/)[6], 1)
  348.     end
  349.   end
  350.   #..........................................................................
  351.   #--------------------------------------------------------------------------
  352.   # ● 释放
  353.   #--------------------------------------------------------------------------
  354.   def dispose
  355.     if self.bitmap != nil
  356.       self.bitmap.dispose
  357.     end
  358.     super
  359.   end
  360.   #--------------------------------------------------------------------------
  361.   # ● 刷新画面
  362.   #--------------------------------------------------------------------------
  363.   def update
  364.     super
  365.     # 战斗者为 nil 的情况下
  366.     if @battler == nil
  367.       self.bitmap = nil
  368.       loop_animation(nil)
  369.       return
  370.     end
  371.     # 文件名和色相与当前情况有差异的情况下
  372.     if @battler.battler_name != @battler_name or
  373.        @battler.battler_hue != @battler_hue
  374.       @battler_hue = @battler.battler_hue
  375.       # 获取、设置位图
  376.       @battler_name = @battler.battler_name
  377.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  378.       #.......................................................................
  379.       @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  380.       #.......................................................................
  381.       @width = bitmap.width
  382.       @height = bitmap.height
  383.       self.ox = @width / 2
  384.       self.oy = @height
  385.       # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
  386.       if @battler.is_a?(Game_Enemy)
  387.         if @battler.dead? or @battler.hidden
  388.           self.opacity = 0
  389.         end
  390.       end
  391.     end
  392.     # 动画 ID 与当前的情况有差异的情况下
  393.     #.........................................................................
  394.     if @battler.battler_ani != @battler_ani
  395.       @battler_ani = @battler.battler_ani
  396.       loop_animation($data_animations[@battler_ani.to_i])
  397.     end
  398.     #.........................................................................
  399.     # 应该被显示的角色的情况下
  400.     if @battler.is_a?(Game_Actor) and @battler_visible
  401.       # 不是主状态的时候稍稍降低点透明度
  402.       if $game_temp.battle_main_phase
  403.         self.opacity += 3 if self.opacity < 255
  404.       else
  405.         self.opacity -= 3 if self.opacity > 207
  406.       end
  407.     end
  408.     # 明灭
  409.     if @battler.blink
  410.       blink_on
  411.     else
  412.       blink_off
  413.     end
  414.     # 不可见的情况下
  415.     unless @battler_visible
  416.       # 出现 ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  417.       if not @battler.hidden and not @battler.dead? and
  418.          (@battler.damage == nil or @battler.damage_pop)
  419.         if @battler.is_a?(Game_Enemy)
  420.           appear
  421.         else
  422.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  423.         end
  424.         @battler_visible = true
  425.       end
  426.     end
  427.     # 可见的情况下
  428.     if @battler_visible
  429.       # 逃跑
  430.       if @battler.hidden
  431.         $game_system.se_play($data_system.escape_se)
  432.         escape
  433.         @battler_visible = false
  434.       end
  435.       # 白色闪烁
  436.       if @battler.white_flash
  437.         whiten
  438.         @battler.white_flash = false
  439.       end
  440.       # 动画
  441.       if @battler.animation_id != 0
  442.         animation = $data_animations[@battler.animation_id]
  443.         animation(animation, @battler.animation_hit)
  444.         @battler.animation_id = 0
  445.       end
  446.       # 伤害
  447.       if @battler.damage_pop
  448.         damage(@battler.damage, @battler.critical)
  449.         @battler.damage = nil
  450.         @battler.critical = false
  451.         @battler.damage_pop = false
  452.       end
  453.       # korapusu
  454.       if @battler.damage == nil and @battler.dead?
  455.         #....................................................................
  456.         if @battler.is_a?(Game_Enemy)
  457.           $game_system.se_play($data_system.enemy_collapse_se)
  458.           #collapse
  459.         else
  460.           $game_system.se_play($data_system.actor_collapse_se)
  461.         end
  462.         #....................................................................
  463.         @battler_visible = false
  464.       end
  465.     end
  466.     # 设置活动块的坐标
  467.     self.x = @battler.screen_x
  468.     self.y = @battler.screen_y
  469.     self.z = @battler.screen_z
  470.   end
  471. end

  472. module RPG
  473. #--------------------------------------------------------------------------
  474. # ● 常量设定
  475. #--------------------------------------------------------------------------
  476. # 是否显示总伤害
  477. SHOW_TOTAL_DAMAGE = true
  478. # 角色受攻击时是否跳一下
  479. BATTLER_JUMP = true

  480. class Sprite < ::Sprite
  481.    #==========================================
  482.    # 修改说明:
  483.    # @flash_shake用来制作挨打时候跳跃
  484.    # @_damage    用来记录每次打击之后弹出数字
  485.    # @_total_damage 记录总伤害
  486.    # @_total_damage_duration 总伤害持续帧
  487.    #==========================================
  488.    #alias 66RPG_rainbow_initialize : initialize
  489.    def initialize(viewport = nil)
  490.      #66RPG_rainbow_initialize(viewport)
  491.      super(viewport)
  492.      @_whiten_duration = 0
  493.      @_appear_duration = 0
  494.      @_escape_duration = 0
  495.      @_collapse_duration = 0
  496.      @_damage_duration = 0
  497.      @_animation_duration = 0
  498.      @_blink = false
  499.      # 挨打时候跳跃
  500.      @flash_shake = 0
  501.      # 伤害记录数组
  502.      @_damage = []
  503.      # 总伤害数字
  504.      @_total_damage = 0
  505.      # 总伤害持续帧
  506.      @_total_damage_duration = 0
  507.      #.........................................................................
  508.      @hits = 0
  509.      #.........................................................................
  510.    end
  511.    def damage(value, critical)
  512.      #.........................................................................
  513.      #清除hit数
  514.      dispose_hit
  515.      #.........................................................................
  516.      if value.is_a?(Numeric)
  517.        damage_string = value.abs.to_s
  518.      else
  519.        damage_string = value.to_s
  520.      end
  521.      bitmap = Bitmap.new(160, 48)
  522.      bitmap.font.name = "黑体"
  523.      bitmap.font.size = 24
  524.      bitmap.font.color.set(0, 0, 0)
  525.      bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
  526.      bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
  527.      bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
  528.      bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
  529.      #=======================================
  530.      # 修改:颜色
  531.      #=======================================
  532.      if value.is_a?(Numeric) and value < 0
  533.        bitmap.font.color.set(176, 255, 144)
  534.      else
  535.        bitmap.font.color.set(255, 55, 55)
  536.      end
  537.      bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  538.      if critical
  539.        bitmap.font.size = 20
  540.        bitmap.font.color.set(0, 0, 0)
  541.        bitmap.draw_text(-1, -1, 160, 20, "暴击", 1)
  542.        bitmap.draw_text(+1, -1, 160, 20, "暴击", 1)
  543.        bitmap.draw_text(-1, +1, 160, 20, "暴击", 1)
  544.        bitmap.draw_text(+1, +1, 160, 20, "暴击", 1)
  545.        bitmap.font.color.set(255, 255, 255)
  546.        bitmap.draw_text(0, 0, 160, 20, "暴击", 1)
  547.      end
  548.      @_damage_sprite = ::Sprite.new#(self.viewport)
  549.      @_damage_sprite.bitmap = bitmap
  550.      @_damage_sprite.ox = 80
  551.      @_damage_sprite.oy = 20
  552.      @_damage_sprite.x = self.x
  553.      @_damage_sprite.y = self.y - self.oy / 2
  554.      @_damage_sprite.z = 3000
  555.      @_damage_duration = 40
  556.      #=======================================
  557.      # 修改:推入新的伤害
  558.      #=======================================
  559.      @_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
  560.      # 总伤害处理
  561.      make_total_damage(value)
  562.    end
  563.    #--------------------------------------------------------------------------
  564.    # ● 返回 @hits
  565.    #--------------------------------------------------------------------------
  566.    def get_hit
  567.      return @hits
  568.    end
  569.    #--------------------------------------------------------------------------
  570.    # ● hit数的美化描绘
  571.    #--------------------------------------------------------------------------
  572.    #..........................................................................
  573.    def hit
  574.      # 如果伤害值是数值
  575.      # 转为字符串
  576.      value=@hits
  577.      hits_string = value.to_s
  578.      # 初始化位图
  579.      bitmap = Bitmap.new(320, 64)
  580.      bitmap.font.name = "黑体"
  581.      bitmap.font.size = 32
  582.      # 分割伤害值字符串
  583.      hits_array = hits_string.scan(/./)
  584.      hits_x = - 36.2#hits_string.size * 18.1 # 81 - hits_string.size * 18.1
  585.      rect_y = 0
  586.      # 循环伤害值字符串
  587.      for char in hits_array
  588.        # 后移一位
  589.        hits_x += 36.2
  590.        number = char.to_i
  591.        # 显示伤害数字
  592.        bitmap.blt(hits_x, 0, RPG::Cache.picture("Number"),
  593.        Rect.new(number * 36.2, rect_y, 36.2, 50))
  594.      end
  595.      hits_x += 18.1
  596.      bitmap.blt(hits_x, 0, RPG::Cache.picture("HITS"),
  597.                 Rect.new(0, -21, 90, 50))
  598.      # 伤害值定位
  599.      @_hits_sprite = ::Sprite.new(self.viewport)
  600.      @_hits_sprite.bitmap = bitmap
  601.      @_hits_sprite.x = 560 - hits_string.size * 36.2
  602.      @_hits_sprite.y = 70
  603.      @_hits_sprite.z = 3000
  604.      @_hits_duration = 40
  605.    end
  606.    #..........................................................................
  607.    #--------------------------------------------------------------------------
  608.    # ● 总伤害处理
  609.    #--------------------------------------------------------------------------
  610.    def make_total_damage(value)
  611.      if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE
  612.        @_total_damage += value
  613.      else
  614.        return
  615.      end
  616.      bitmap = Bitmap.new(300, 150)
  617.      bitmap.font.name = "黑体"
  618.      bitmap.font.size = 28
  619.      bitmap.font.color.set(0, 0, 0)
  620.      bitmap.draw_text(+2, 12+2, 160, 36, @_total_damage.abs.to_s, 1)
  621.      if @_total_damage < 0
  622.        bitmap.font.color.set(80, 255, 00)
  623.      else
  624.        bitmap.font.color.set(255, 140, 0)
  625.      end
  626.      bitmap.draw_text(0, 12, 160, 36, @_total_damage.abs.to_s, 1)
  627.      if @_total_damage_sprite.nil?
  628.        @_total_damage_sprite = ::Sprite.new#(self.viewport)
  629.        @_total_damage_sprite.ox = 80
  630.        @_total_damage_sprite.oy = 20
  631.        @_total_damage_sprite.z = 3000
  632.      end
  633.      @_total_damage_sprite.bitmap = bitmap
  634.      @_total_damage_sprite.zoom_x = 1.5
  635.      @_total_damage_sprite.zoom_y = 1.5
  636.      @_total_damage_sprite.x = self.x
  637.      @_total_damage_sprite.y = self.y  - self.oy / 2 - 64
  638.      @_total_damage_sprite.z = 3001
  639.      #.........................................................................
  640.      @_total_damage_duration = 40
  641.      #.........................................................................
  642.      #.........................................................................
  643.      #hit数描绘
  644.      @hits+=1
  645.      hit
  646.      #.........................................................................
  647.    end
  648.    def animation(animation, hit, battler_damage="", battler_critical=false)
  649.      dispose_animation      
  650.      #=======================================
  651.      # 修改:记录伤害和critical
  652.      #=======================================
  653.      @battler_damage = battler_damage
  654.      @battler_critical = battler_critical
  655.      @_animation = animation
  656.      return if @_animation == nil
  657.      @_animation_hit = hit
  658.      @_animation_duration = @_animation.frame_max
  659.      animation_name = @_animation.animation_name
  660.      animation_hue = @_animation.animation_hue
  661.      bitmap = RPG::Cache.animation(animation_name, animation_hue)
  662.      #=======================================
  663.      # 修改:计算总闪光权限值
  664.      #=======================================
  665.      for timing in @_animation.timings
  666.        quanzhong = animation_process_timing(timing, @_animation_hit,true)
  667.        @all_quanzhong += quanzhong
  668.        # 记录最后一次闪光
  669.        @_last_frame = timing.frame if quanzhong != 0
  670.      end
  671.      #.........................................................................
  672.      @last_frame = @_last_frame
  673.      #.........................................................................
  674.      if @@_reference_count.include?(bitmap)
  675.        @@_reference_count[bitmap] += 1
  676.      else
  677.        @@_reference_count[bitmap] = 1
  678.      end
  679.      #=======================================
  680.      # 修改:行动方动画不显示伤害
  681.      #=======================================
  682.      if $scene.is_a?(Scene_Battle)
  683.        if $scene.animation1_id == @battler.animation_id
  684.          @battler_damage = ""
  685.        end
  686.      end
  687.      @_animation_sprites = []
  688.      if @_animation.position != 3 or not @@_animations.include?(animation)
  689.        for i in 0..15
  690.          sprite = ::Sprite.new(self.viewport)
  691.          sprite.bitmap = bitmap
  692.          sprite.visible = false
  693.          @_animation_sprites.push(sprite)
  694.        end
  695.        unless @@_animations.include?(animation)
  696.          @@_animations.push(animation)
  697.        end
  698.      end
  699.      update_animation
  700.    end
  701.    #=======================================
  702.    # 修改:更换清除伤害的算法,以防万一
  703.    #       本内容在脚本中没有使用过
  704.    #=======================================
  705.    def dispose_damage
  706.      for damage in @_damage.reverse
  707.        damage[0].bitmap.dispose
  708.        damage[0].dispose
  709.        @_damage.delete(damage)
  710.      end
  711.      @_total_damage = 0
  712.      @_last_frame = -1
  713.      if @_total_damage_sprite != nil
  714.        @_total_damage_duration = 0
  715.        @_total_damage_sprite.bitmap.dispose
  716.        @_total_damage_sprite.dispose
  717.        @_total_damage_sprite = nil
  718.      end
  719.    end
  720.    #=======================================
  721.    # 清除hit数
  722.    #=======================================
  723.    #...........................................................................
  724.    def dispose_hit
  725.      if @_hits_sprite != nil
  726.        @_hits_sprite.bitmap.dispose
  727.        @_hits_sprite.dispose
  728.        @_hits_sprite = nil
  729.      end
  730.    end
  731.    #...........................................................................
  732.    def dispose_animation
  733.      #=======================================
  734.      # 修改:清除记录的伤害,清除权重记录
  735.      #=======================================
  736.      @battler_damage = nil
  737.      @battler_critical = nil
  738.      @all_quanzhong = 1
  739.      @_total_damage = 0
  740.      @_last_frame = -1
  741.      #.........................................................................
  742.      @hits = 0
  743.      #.........................................................................
  744.      if @_animation_sprites != nil
  745.        sprite = @_animation_sprites[0]
  746.        if sprite != nil
  747.          @@_reference_count[sprite.bitmap] -= 1
  748.          if @@_reference_count[sprite.bitmap] == 0
  749.            sprite.bitmap.dispose
  750.          end
  751.        end
  752.        for sprite in @_animation_sprites
  753.          sprite.dispose
  754.        end
  755.        @_animation_sprites = nil
  756.        @_animation = nil
  757.      end
  758.    end
  759.    def update
  760.      super
  761.      if @_whiten_duration > 0
  762.        @_whiten_duration -= 1
  763.        self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  764.      end
  765.      if @_appear_duration > 0
  766.        @_appear_duration -= 1
  767.        self.opacity = (16 - @_appear_duration) * 16
  768.      end
  769.      if @_escape_duration > 0
  770.        @_escape_duration -= 1
  771.        self.opacity = 256 - (32 - @_escape_duration) * 10
  772.      end
  773.      if @_collapse_duration > 0
  774.        @_collapse_duration -= 1
  775.        self.opacity = 256 - (48 - @_collapse_duration) * 6
  776.      end
  777.      #=======================================
  778.      # 修改:更新算法,更新弹出
  779.      #=======================================
  780.      if @_damage_duration > 0
  781.        @_damage_duration -= 1
  782.        for damage in @_damage
  783.          damage[0].x = self.x + self.viewport.rect.x -
  784.                        self.ox + self.src_rect.width / 2 +
  785.                        (40 - damage[1]) * damage[3] / 10
  786.          damage[0].y -= damage[4]+damage[1]/10
  787.          damage[0].opacity = damage[1]*20
  788.          damage[1] -= 1
  789.          if damage[1]==0
  790.            damage[0].bitmap.dispose
  791.            damage[0].dispose
  792.            @_damage.delete(damage)
  793.            next
  794.          end
  795.        end
  796.      end
  797.      #=======================================
  798.      # 添加:弹出总伤害
  799.      #=======================================
  800.      if @_total_damage_duration > 0
  801.        @_total_damage_duration -= 1
  802.        @_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
  803.        if @_total_damage_sprite.zoom_x > 1.0
  804.          @_total_damage_sprite.zoom_x -= 0.05
  805.        end
  806.        if @_total_damage_sprite.zoom_y > 1.0
  807.          @_total_damage_sprite.zoom_y -= 0.05
  808.        end
  809.        @_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
  810.        #......................................................................
  811.        if @_total_damage_duration <= 7 and @_total_damage_duration > 0
  812.          @_hits_sprite.opacity -= 32
  813.          @_hits_sprite.x += 1
  814.        end
  815.        #......................................................................
  816.        if @_total_damage_duration <= 0
  817.          #.....................................................................
  818.          dispose_hit
  819.          #.....................................................................
  820.          @_total_damage = 0
  821.          @_total_damage_duration = 0
  822.          @_total_damage_sprite.bitmap.dispose
  823.          @_total_damage_sprite.dispose
  824.          @_total_damage_sprite = nil
  825.        end
  826.      end
  827.      #=======================================
  828.      if @_animation != nil and (Graphics.frame_count % 2 == 0)
  829.        @_animation_duration -= 1
  830.        update_animation
  831.      end
  832.      if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  833.        update_loop_animation
  834.        @_loop_animation_index += 1
  835.        #......................................................................
  836.        @loop_animation_once = 0
  837.        @loop_animation_once = 1 if @once == 1 and @_loop_animation_index == @_loop_animation.frame_max
  838.        #......................................................................
  839.        @_loop_animation_index %= @_loop_animation.frame_max
  840.      end
  841.      if @_blink
  842.        @_blink_count = (@_blink_count + 1) % 32
  843.        if @_blink_count < 16
  844.          alpha = (16 - @_blink_count) * 6
  845.        else
  846.          alpha = (@_blink_count - 16) * 6
  847.        end
  848.        self.color.set(255, 255, 255, alpha)
  849.      end
  850.      @@_animations.clear
  851.    end
  852.    #..........................................................................
  853.    def loop_animation_once
  854.      return @_loop_animation_once
  855.    end
  856.    #..........................................................................
  857.    def update_animation
  858.      if @_animation_duration > 0
  859.        frame_index = @_animation.frame_max - @_animation_duration
  860.        @frame_index = frame_index
  861.        cell_data = @_animation.frames[frame_index].cell_data
  862.        position = @_animation.position
  863.        animation_set_sprites(@_animation_sprites, cell_data, position)
  864.        #=======================================
  865.        # 修改:弹出伤害,权重计算
  866.        #=======================================
  867.        for timing in @_animation.timings
  868.          if timing.frame == frame_index
  869.            t = 1.0 * animation_process_timing(timing, @_animation_hit)            
  870.            #p t,"当前权重", @all_quanzhong,"总权重"
  871.            if @battler_damage.is_a?(Numeric) and t != 0
  872.              t *= @battler_damage
  873.              t /= @all_quanzhong
  874.              #p t,"当前伤害",@battler_damage,"总伤害"
  875.              t = t.to_i
  876.              # 最后一次闪光的话,伤害修正
  877.              if frame_index == @_last_frame
  878.                @_total_damage = @battler_damage - t
  879.              end
  880.              #p t,@battler_damage,@all_quanzhong
  881.              damage(t,@battler_critical)
  882.            # 防止重复播放miss
  883.            elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
  884.              damage(@battler_damage,@battler_critical)
  885.            end
  886.          end
  887.        end
  888.      else
  889.        dispose_animation
  890.      end
  891.    end
  892.    #=======================================
  893.    # 修改:敌人跳跃的功能 + 添加返回数值
  894.    #=======================================
  895.    def update_loop_animation
  896.      frame_index = @_loop_animation_index
  897.      cell_data = @_loop_animation.frames[frame_index].cell_data
  898.      position = @_loop_animation.position
  899.      #·改·
  900.      if @wait_count.to_i <= 0
  901.        @wait_count = 0
  902.        animation_set_sprites(@_loop_animation_sprites, cell_data, position)
  903.      else
  904.        @wait_count -= 1
  905.        for sprite in @_loop_animation_sprites
  906.          sprite.visible = false
  907.        end
  908.      end
  909.      if @wait_flash.to_i <= 0
  910.        @wait_flash = 0
  911.      else
  912.        @wait_flash -= 1
  913.        for sprite in @_loop_animation_sprites
  914.          sprite.blend_type = 1
  915.        end
  916.      end
  917.      #·改·
  918.      for timing in @_loop_animation.timings
  919.        if timing.frame == frame_index
  920.          animation_process_timing(timing, true)
  921.        end
  922.      end
  923.    end
  924.    #=======================================
  925.    # 修改:敌人跳跃的功能 + 添加返回数值
  926.    #=======================================
  927.    def loop_animation(animation)
  928.      return if animation == @_loop_animation
  929.      dispose_loop_animation
  930.      @_loop_animation = animation
  931.      return if @_loop_animation == nil
  932.      @_loop_animation_index = 0
  933.      animation_name = @_loop_animation.animation_name
  934.      animation_hue = @_loop_animation.animation_hue
  935.      bitmap = RPG::Cache.animation(animation_name, animation_hue)
  936.      if @@_reference_count.include?(bitmap)
  937.        @@_reference_count[bitmap] += 1
  938.      else
  939.        @@_reference_count[bitmap] = 1
  940.      end
  941.      @_loop_animation_sprites = []
  942.      for i in 0..15
  943.        sprite = ::Sprite.new
  944.        sprite.bitmap = bitmap
  945.        sprite.visible = false
  946.        @_loop_animation_sprites.push(sprite)
  947.      end
  948.      update_loop_animation
  949.    end
  950.    #=======================================
  951.    # 修改:敌人跳跃的功能 + 添加返回数值
  952.    #=======================================
  953.     def animation_process_timing(timing, hit,dontflash=false)
  954.       if (timing.condition == 0) or
  955.          (timing.condition == 1 and hit == true) or
  956.          (timing.condition == 2 and hit == false)
  957.         unless dontflash
  958.           if timing.se.name != ""
  959.             se = timing.se
  960.             Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
  961.           end
  962.         end
  963.         case timing.flash_scope
  964.         when 1
  965.           unless dontflash
  966.             self.flash(timing.flash_color, timing.flash_duration * 2)
  967.             #....................................................................
  968.             @wait_flash = timing.flash_duration
  969.             #....................................................................
  970.             if @_total_damage >0
  971.               @flash_shake_switch = true
  972.               @flash_shake = 10
  973.             end
  974.           end
  975.           return timing.flash_color.alpha * timing.flash_duration
  976.         when 2
  977.           unless dontflash
  978.             if self.viewport != nil
  979.               self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
  980.               return timing.flash_color.alpha * timing.flash_duration
  981.             end
  982.           end
  983.         when 3
  984.           unless dontflash
  985.             self.flash(nil, timing.flash_duration * 2)
  986.             #@_loop_animation_count = 1
  987.             #·改·
  988.             @wait_count = timing.flash_duration
  989.             #·改·
  990.           end
  991.           return timing.flash_color.alpha * timing.flash_duration
  992.         end
  993.       end      
  994.       return 0
  995.     end   
  996. end
  997. end
  998. #==============================================================================
  999. # ■ Sprite_Battler
  1000. #==============================================================================
  1001. class Sprite_Battler < RPG::Sprite
  1002. #--------------------------------------------------------------------------
  1003. # ● 初始化对像
  1004. #    添加跳跃记录
  1005. #--------------------------------------------------------------------------
  1006. def initialize(viewport, battler = nil)
  1007.   super(viewport)
  1008.   @battler = battler
  1009.   @battler_visible = false
  1010.   @flash_shake_switch = true
  1011.   #........................................................................
  1012.   @once = 0
  1013.   @frame_index = -1
  1014.   @last_frame = 0
  1015.   #........................................................................
  1016. end
  1017. #--------------------------------------------------------------------------
  1018. # ● 刷新画面
  1019. #    增添跳跃功能
  1020. #--------------------------------------------------------------------------
  1021. def update
  1022.   super
  1023.   # 战斗者为 nil 的情况下
  1024.   if @battler == nil
  1025.     self.bitmap = nil
  1026.     loop_animation(nil)
  1027.     return
  1028.   end
  1029.   # 文件名和色相与当前情况有差异的情况下
  1030.   if @battler.battler_name != @battler_name or
  1031.      @battler.battler_hue != @battler_hue
  1032.     # 获取、设置位图
  1033.     @battler_name = @battler.battler_name
  1034.     @battler_hue = @battler.battler_hue
  1035.     self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  1036.     #.......................................................................
  1037.     if not @battler.hidden and not @battler.dead?
  1038.       @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  1039.     end
  1040.     #.......................................................................
  1041.     @width = bitmap.width
  1042.     @height = bitmap.height
  1043.     self.ox = @width / 2
  1044.     self.oy = @height
  1045.   end
  1046.   #.......................................................................
  1047.   update_actor_animation
  1048.   update_enemy_animation
  1049.   #.......................................................................
  1050.   # 动画 ID 与当前的情况有差异的情况下
  1051.   #.........................................................................
  1052.   if @battler.is_a?(Game_Enemy)
  1053.     if @once == 1 and @loop_animation_once == 1 and
  1054.        @battler.battler_dead_ani == 1
  1055.       @battler.setup_battler_ani(@battler.battler_name.split(/★/)[5])
  1056.     elsif @once == 1 and @loop_animation_once == 1 and $scene.phase != 5
  1057.       @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  1058.     end
  1059.   end
  1060.   if @battler.is_a?(Game_Actor)
  1061.     if @once == 1 and @loop_animation_once == 1 and $scene.phase != 5 and
  1062.        @battler.battler_dead_ani == 1
  1063.       @battler.setup_battler_ani(@battler.battler_name.split(/★/)[5])
  1064.     elsif @once == 1 and @loop_animation_once == 1 and $scene.phase != 5
  1065.       @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  1066.     elsif @once == 1 and @loop_animation_once == 1 and $scene.phase == 5 and
  1067.           not @battler.dead?
  1068.       @battler.setup_battler_ani(@battler.battler_name.split(/★/)[7])
  1069.     end
  1070.   end
  1071.   if @battler.battler_ani != @battler_ani
  1072.     @battler_ani = @battler.battler_ani
  1073.     @once = @battler.battler_ani_once
  1074.     loop_animation($data_animations[@battler_ani.to_i])
  1075.   end
  1076.   #.........................................................................
  1077.   # 应该被显示的角色的情况下
  1078.   if @battler.is_a?(Game_Actor) and @battler_visible
  1079.     # 不是主状态的时候稍稍降低点透明度
  1080.     if $game_temp.battle_main_phase
  1081.       self.opacity += 3 if self.opacity < 255
  1082.     else
  1083.       self.opacity -= 3 if self.opacity > 207
  1084.     end
  1085.   end
  1086.   # 明灭
  1087.   if @battler.blink
  1088.     blink_on
  1089.   else
  1090.     blink_off
  1091.   end
  1092.   # 不可见的情况下
  1093.   unless @battler_visible
  1094.     # 出现
  1095.     if not @battler.hidden and not @battler.dead? and
  1096.        (@battler.damage == nil or @battler.damage_pop)
  1097.       #.......................................................................
  1098.       if @battler.is_a?(Game_Enemy)
  1099.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  1100.         #appear
  1101.       else
  1102.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  1103.       end
  1104.       #.......................................................................
  1105.       @battler_visible = true
  1106.     end
  1107.   end
  1108.   # 可见的情况下
  1109.   if @battler_visible
  1110.     # 逃跑
  1111.     if @battler.hidden
  1112.       $game_system.se_play($data_system.escape_se)
  1113.       escape
  1114.       @battler_visible = false
  1115.     end
  1116.     # 白色闪烁
  1117.     if @battler.white_flash
  1118.       whiten
  1119.       @battler.white_flash = false
  1120.     end
  1121.     # 动画
  1122.     if @battler.animation_id != 0
  1123.       animation = $data_animations[@battler.animation_id]
  1124.       animation(animation, @battler.animation_hit,@battler.damage, @battler.critical)
  1125.       @battler.animation_id = 0
  1126.     end
  1127.     # 伤害
  1128.     if @battler.damage_pop
  1129.       @battler.damage = nil
  1130.       @battler.critical = false
  1131.       @battler.damage_pop = false
  1132.     end
  1133.     # korapusu
  1134.     if @battler.damage == nil and @battler.dead?
  1135.       if @battler.is_a?(Game_Enemy)
  1136.         if @battler.battler_dead_ani != 1
  1137.           #p "Battler Death Error"
  1138.           $game_system.se_play($data_system.enemy_collapse_se)
  1139.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  1140.           @battler.setup_battler_dead_ani(1)
  1141.         end
  1142.         #.....................................................................
  1143.         collapse
  1144.         #.....................................................................
  1145.       else
  1146.         #.....................................................................
  1147.         if @battler.battler_dead_ani != 1
  1148.           #p "Battler Death Error"
  1149.           $game_system.se_play($data_system.enemy_collapse_se)
  1150.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  1151.           @battler.setup_battler_dead_ani(1)
  1152.         end
  1153.         #.....................................................................
  1154.       end
  1155.       @battler_visible = false
  1156.     end
  1157.   end
  1158.   # 设置活动块的坐标
  1159.   if @flash_shake_switch == true
  1160.     self.x = @battler.screen_x
  1161.     self.y = @battler.screen_y
  1162.     self.z = @battler.screen_z
  1163.     @flash_shake_switch = false
  1164.   end
  1165.   if @flash_shake != 0 and @battler.damage != nil and RPG::BATTLER_JUMP
  1166.     if @battler.is_a?(Game_Enemy)
  1167.       case @flash_shake
  1168.       when 9..10
  1169.         self.x -=4
  1170.         self.y -=4
  1171.         self.z = @battler.screen_z
  1172.       when 6..8
  1173.         self.x -=2
  1174.         self.y -=2
  1175.         self.z = @battler.screen_z
  1176.       when 3..5
  1177.         self.x +=2
  1178.         self.y +=2
  1179.         self.z = @battler.screen_z
  1180.       when 1..2
  1181.         self.x +=4
  1182.         self.y +=4
  1183.         self.z = @battler.screen_z
  1184.       end
  1185.     end
  1186.     if @battler.is_a?(Game_Actor)
  1187.       case @flash_shake
  1188.       when 9..10
  1189.         self.x +=4
  1190.         self.y +=4
  1191.         self.z = @battler.screen_z
  1192.       when 6..8
  1193.         self.x +=2
  1194.         self.y +=2
  1195.         self.z = @battler.screen_z
  1196.       when 3..5
  1197.         self.x -=2
  1198.         self.y -=2
  1199.         self.z = @battler.screen_z
  1200.       when 1..2
  1201.         self.x -=4
  1202.         self.y -=4
  1203.         self.z = @battler.screen_z
  1204.       end
  1205.     end
  1206.     @flash_shake -= 1
  1207.   end
  1208. end
  1209. end

  1210. #==============================================================================
  1211. # ■ Scene_Battle
  1212. #------------------------------------------------------------------------------
  1213. #  处理战斗画面的类。
  1214. #==============================================================================

  1215. class Scene_Battle
  1216. #--------------------------------------------------------------------------
  1217. # ● 定义实例变量
  1218. #--------------------------------------------------------------------------
  1219. attr_reader   :animation1_id                    # 行动方动画ID
  1220. end
  1221. class Sprite_Battler < RPG::Sprite
  1222.   #--------------------------------------------------------------------------
  1223.   # ● 处理角色动作
  1224.   #--------------------------------------------------------------------------
  1225.   def update_actor_animation
  1226.     if @battler.is_a?(Game_Actor)
  1227.       if @battler.show_damage_value != nil
  1228.         self.damage(@battler.show_damage_value, false)
  1229.         @battler.show_damage(nil)
  1230.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  1231.         @battler.setup_battler_hurt_ani(1)
  1232.       end
  1233.       if @battler.current_action.kind == 0 and @battler.current_action.basic == 1
  1234.       else
  1235.         if @hits == 1 and not @battler.dead? and @battler.battler_hurt_ani != 1 and @battler.damage.is_a?(Numeric) and @battler.damage > 0
  1236.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  1237.           @battler.setup_battler_hurt_ani(1)
  1238.         elsif @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
  1239.           for actor in $game_party.actors
  1240.             if @battler != actor
  1241.               actor.add_state(6)
  1242.             end
  1243.           end
  1244.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  1245.           @battler.setup_battler_dead_ani(1)
  1246.         end
  1247.       end
  1248.     end
  1249.   end
  1250.   #--------------------------------------------------------------------------
  1251.   # ● 处理敌人动作
  1252.   #--------------------------------------------------------------------------
  1253.   def update_enemy_animation
  1254.     if @battler.is_a?(Game_Enemy)
  1255.       if @battler.show_damage_value != nil
  1256.         self.damage(@battler.show_damage_value, false)
  1257.         @battler.show_damage(nil)
  1258.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  1259.         @battler.setup_battler_hurt_ani(1)
  1260.       end
  1261.       if @battler.current_action.kind == 0 and @battler.current_action.basic == 1
  1262.       else
  1263.         if @hits == 1 and not @battler.dead? and @battler.battler_hurt_ani != 1 and @battler.damage.is_a?(Numeric) and @battler.damage > 0
  1264.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  1265.           @battler.setup_battler_hurt_ani(1)
  1266.         elsif @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
  1267.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  1268.           @battler.setup_battler_dead_ani(1)
  1269.           collapse
  1270.         end
  1271.       end
  1272.     end
  1273.   end
  1274. end
复制代码

点评

我当然知道呀,就是不知道怎么改动画Z值才崩溃嘛……  发表于 2015-5-30 17:46
全动画战斗的动作是动画Z值,不是角色图片Z值。  发表于 2015-5-30 17:17

博客:我的博客

Lv1.梦旅人

梦石
0
星屑
50
在线时间
226 小时
注册时间
2015-5-8
帖子
329
2
发表于 2015-5-30 18:11:33 | 只看该作者
  1. #==============================================================================
  2. # ■ Spriteset_Battle
  3. #------------------------------------------------------------------------------
  4. #  处理战斗画面的活动块的类。本类在 Scene_Battle 类
  5. # 的内部使用。
  6. #==============================================================================

  7. class Spriteset_Battle
  8.   
  9. def @battler.screen_z
  10.     case self.index
  11.     when 0
  12.       return 100
  13.     when 1
  14.       return 90
  15.     when 2
  16.       return 80
  17.     when 3
  18.       return 70
  19.        else
  20.       return 0
  21.     end
  22.   end
  23. end
复制代码
隨便寫的,不知道語法錯了沒。
或許部分語句還要改改。
我是妖精蕾貝卡,沉默少言,孤獨自卑。完成了一個小遊戲,歡迎試玩。同時也歡迎試玩師傅的遊戲,謝謝。
現正在努力學習事件中,有不明白的地方請各位指教。

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3176
在线时间
1442 小时
注册时间
2009-7-27
帖子
1454
3
 楼主| 发表于 2015-5-30 19:21:04 | 只看该作者
妖精蕾贝卡 发表于 2015-5-30 18:11
隨便寫的,不知道語法錯了沒。
或許部分語句還要改改。

没用的,是要角色动画的Z值,不是图片

博客:我的博客
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3176
在线时间
1442 小时
注册时间
2009-7-27
帖子
1454
4
 楼主| 发表于 2015-5-31 00:45:28 | 只看该作者
我搜了一下全站关于这个问题的帖子,原来以前也有很多人问这个问题,全站居然没有一个人能解决这个问题……难道这个脚本真的就要这么一直美中不足下去了吗?

点评

看到z就修改试试,或者添加viewport,修改这个的z值,按理说这个的z会比图片的z要高级  发表于 2015-5-31 07:09

博客:我的博客
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
帖子
1516
5
发表于 2015-5-31 07:15:49 | 只看该作者
  @viewport1 = Viewport.new(0, 0, 640, 480)
    @viewport2 = Viewport.new(0, 0, 640, 480)
    @viewport3 = Viewport.new(0, 0, 640, 480)
    @viewport4 = Viewport.new(0, 0, 640, 480)
这里添加个567
    @viewport2.z = 101
这里设置一下567的z值
    @viewport3.z = 200
    @viewport4.z = 5000
    # 生成战斗背景活动块
    @battleback_sprite = Sprite.new(@viewport1)
    # 生成敌人活动块
    @enemy_sprites = []
    for enemy in $game_troop.enemies.reverse
      @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
    end
    # 生成敌人活动块
    @actor_sprites = []
    @actor_sprites.push(Sprite_Battler.new(@viewport2))
#下面修改成567
    @actor_sprites.push(Sprite_Battler.new(@viewport2))
    @actor_sprites.push(Sprite_Battler.new(@viewport2))
    @actor_sprites.push(Sprite_Battler.new(@viewport2))
下面有2的也添上567的
 

点评

把测试所需的工程发一下,改脚本需要不断测试。(*^ω^*)  发表于 2015-6-1 07:48
有啊,就是没反应  发表于 2015-5-31 22:43
@viewport7等的z值有没有改?  发表于 2015-5-31 14:31
不行,没有冲突也没有改变  发表于 2015-5-31 13:12
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3176
在线时间
1442 小时
注册时间
2009-7-27
帖子
1454
6
 楼主| 发表于 2015-5-31 07:55:04 | 只看该作者
本帖最后由 爆焰 于 2015-5-31 08:04 编辑
汪汪 发表于 2015-5-31 07:15
  @viewport1 = Viewport.new(0, 0, 640, 480)
    @viewport2 = Viewport.new(0, 0, 640, 480)
     ...


什么567呀?这么模糊
大概试了一下,没用,不知道是不是错了

点评

手机编辑…… @viewport5 @viewport6 @viewport7  发表于 2015-5-31 11:14

博客:我的博客
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3176
在线时间
1442 小时
注册时间
2009-7-27
帖子
1454
7
 楼主| 发表于 2015-6-1 14:40:18 | 只看该作者
汪汪 发表于 2015-5-31 07:15
  @viewport1 = Viewport.new(0, 0, 640, 480)
    @viewport2 = Viewport.new(0, 0, 640, 480)
     ...

Project2.zip (518.09 KB, 下载次数: 90)
范例,这个问题解决了就发到主站去吧。这样这个脚本相对完美了,也可以帮助到更多的

博客:我的博客
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
帖子
1516
8
发表于 2015-6-1 18:04:26 | 只看该作者
修改搜索 :  额,z值的法子不会用,只好用这个了,看起来效果可以

评分

参与人数 1星屑 +50 梦石 +1 收起 理由
RyanBern + 50 + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3176
在线时间
1442 小时
注册时间
2009-7-27
帖子
1454
9
 楼主| 发表于 2015-6-1 22:30:26 | 只看该作者
汪汪 发表于 2015-6-1 18:04
修改搜索 :  额,z值的法子不会用,只好用这个了,看起来效果可以
[fold]#================================== ...

谢了,测试一段时间先,如果没问题我就去请求发到主站上

点评

总好过一直没人解决这个问题吧  发表于 2015-6-2 09:07
这种法子被人看了会笑死的。-_-||  发表于 2015-6-2 00:33

博客:我的博客
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-22 23:34

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表