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

Project1

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

[已经过期] 求把全动画脚本的待机速度调慢一倍

[复制链接]

Lv1.梦旅人

幻想天神

梦石
0
星屑
55
在线时间
166 小时
注册时间
2012-3-24
帖子
404
跳转到指定楼层
1
发表于 2014-2-1 16:04:15 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
  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. #==============================================================================
  36. class Spriteset_Battle
  37.   #--------------------------------------------------------------------------
  38.   # ● 初始化变量
  39.   #--------------------------------------------------------------------------
  40.   def initialize
  41.     # 生成显示端口
  42.     @viewport1 = Viewport.new(0, 0, 640, 480)
  43.     @viewport2 = Viewport.new(0, 0, 640, 480)
  44.     @viewport3 = Viewport.new(0, 0, 640, 480)
  45.     @viewport4 = Viewport.new(0, 0, 640, 480)
  46.     @viewport2.z = 101
  47.     @viewport3.z = 200
  48.     @viewport4.z = 5000
  49.     # 生成战斗背景活动块
  50.     @battleback_sprite = Sprite.new(@viewport1)
  51.     # 生成敌人活动块
  52.     @enemy_sprites = []
  53.     for enemy in $game_troop.enemies.reverse
  54.       @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
  55.     end
  56.     # 生成敌人活动块
  57.     @actor_sprites = []
  58.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  59.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  60.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  61.     @actor_sprites.push(Sprite_Battler.new(@viewport2))
  62.     # 生成天候
  63.     @weather = RPG::Weather.new(@viewport1)
  64.     # 生成图片活动块
  65.     @picture_sprites = []
  66.     for i in 51..100
  67.       @picture_sprites.push(Sprite_Picture.new(@viewport3,
  68.         $game_screen.pictures[i]))
  69.     end
  70.     # 生成计时器块
  71.     @timer_sprite = Sprite_Timer.new
  72.     # 刷新画面
  73.     update
  74.   end
  75.   #..........................................................................
  76.   #--------------------------------------------------------------------------
  77.   # ● 胜利图
  78.   #--------------------------------------------------------------------------
  79.   def win
  80.     for sprite in @actor_sprites
  81.       sprite.win
  82.     end
  83.   end
  84.   #..........................................................................
  85.   #--------------------------------------------------------------------------
  86.   # ● 刷新画面
  87.   #--------------------------------------------------------------------------
  88.   def update
  89.     # 刷新角色的活动块 (对应角色的替换)
  90.     @actor_sprites[0].battler = $game_party.actors[0]
  91.     @actor_sprites[1].battler = $game_party.actors[1]
  92.     @actor_sprites[2].battler = $game_party.actors[2]
  93.     @actor_sprites[3].battler = $game_party.actors[3]
  94.     # 战斗背景的文件名与现在情况有差异的情况下
  95.     if @battleback_name != $game_temp.battleback_name
  96.       @battleback_name = $game_temp.battleback_name
  97.       if @battleback_sprite.bitmap != nil
  98.         @battleback_sprite.bitmap.dispose
  99.       end
  100.       @battleback_sprite.bitmap = RPG::Cache.battleback(@battleback_name)
  101.       @battleback_sprite.src_rect.set(0, 0, 640, 480)
  102.     end
  103.     # 刷新战斗者的活动块
  104.     for sprite in @enemy_sprites + @actor_sprites
  105.       sprite.update
  106.     end
  107.     # 刷新天气图形
  108.     @weather.type = $game_screen.weather_type
  109.     @weather.max = $game_screen.weather_max
  110.     @weather.update
  111.     # 刷新图片活动块
  112.     for sprite in @picture_sprites
  113.       sprite.update
  114.     end
  115.     # 刷新计时器活动块
  116.     @timer_sprite.update
  117.     # 设置画面的色调与震动位置
  118.     @viewport1.tone = $game_screen.tone
  119.     @viewport1.ox = $game_screen.shake
  120.     # 设置画面的闪烁色
  121.     @viewport4.color = $game_screen.flash_color
  122.     # 刷新显示端口
  123.     @viewport1.update
  124.     @viewport2.update
  125.     @viewport4.update
  126.   end
  127. end
  128. class Arrow_Enemy < Arrow_Base
  129.   #--------------------------------------------------------------------------
  130.   # ● 获取光标指向的敌人
  131.   #--------------------------------------------------------------------------
  132.   def enemy
  133.     return $game_troop.enemies[@index]
  134.   end
  135.   #--------------------------------------------------------------------------
  136.   # ● 刷新画面
  137.   #--------------------------------------------------------------------------
  138.   def update
  139.     super
  140.     # 如果指向不存在的敌人就离开
  141.     $game_troop.enemies.size.times do
  142.       break if self.enemy.exist?
  143.       [url=home.php?mod=space&uid=370741]@Index[/url] += 1
  144.       @index %= $game_troop.enemies.size
  145.     end
  146.     # 光标右
  147.     if Input.repeat?(Input::RIGHT)
  148.       $game_system.se_play($data_system.cursor_se)
  149.       $game_troop.enemies.size.times do
  150.         @index += 1
  151.         @index %= $game_troop.enemies.size
  152.         break if self.enemy.exist?
  153.       end
  154.     end
  155.     # 光标左
  156.     if Input.repeat?(Input::LEFT)
  157.       $game_system.se_play($data_system.cursor_se)
  158.       $game_troop.enemies.size.times do
  159.         @index += $game_troop.enemies.size - 1
  160.         @index %= $game_troop.enemies.size
  161.         break if self.enemy.exist?
  162.       end
  163.     end
  164.     # 设置活动块坐标
  165.     if self.enemy != nil
  166.       self.x = self.enemy.screen_x + self.ox
  167.       self.y = self.enemy.screen_y + self.oy
  168.     end
  169.   end
  170. end
  171. class Arrow_Actor < Arrow_Base
  172.   #--------------------------------------------------------------------------
  173.   # ● 获取光标指向的角色
  174.   #--------------------------------------------------------------------------
  175.   def actor
  176.     return $game_party.actors[@index]
  177.   end
  178.   #--------------------------------------------------------------------------
  179.   # ● 刷新画面
  180.   #--------------------------------------------------------------------------
  181.   def update
  182.     super
  183.     # 光标右
  184.     if Input.repeat?(Input::RIGHT)
  185.       $game_system.se_play($data_system.cursor_se)
  186.       @index += 1
  187.       @index %= $game_party.actors.size
  188.     end
  189.     # 光标左
  190.     if Input.repeat?(Input::LEFT)
  191.       $game_system.se_play($data_system.cursor_se)
  192.       @index += $game_party.actors.size - 1
  193.       @index %= $game_party.actors.size
  194.     end
  195.     # 设置活动块坐标
  196.     if self.actor != nil
  197.       self.x = self.actor.screen_x + self.ox
  198.       self.y = self.actor.screen_y + self.oy
  199.     end
  200.   end
  201. end
  202. class Scene_Battle
  203.   #--------------------------------------------------------------------------
  204.   # ● 刷新画面 (主回合步骤 3 : 行动方动画)
  205.   #--------------------------------------------------------------------------
  206.   def update_phase4_step3
  207.     # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  208.     if @animation1_id == 0
  209.       @active_battler.white_flash = true
  210.     else
  211.       @active_battler.animation_id = @animation1_id
  212.       @active_battler.animation_hit = true
  213.     end
  214.     # 对像方动画
  215.     for target in @target_battlers
  216.       target.animation_id = @animation2_id
  217.       target.animation_hit = (target.damage != "Miss")
  218.       #.......................................................................
  219.       if target.is_a?(Game_Actor)
  220.         if target.current_action.kind == 0 and target.current_action.basic == 1
  221.           target.setup_battler_ani(target.battler_name.split(/★/)[2])
  222.         else
  223.           target.setup_battler_hurt_ani(0)
  224.         end
  225.       end
  226.       if target.is_a?(Game_Enemy)
  227.         if target.current_action.kind == 0 and target.current_action.basic == 1
  228.           target.setup_battler_ani(target.battler_name.split(/★/)[1])
  229.         else
  230.           target.setup_battler_hurt_ani(0)
  231.         end
  232.       end
  233.       #.......................................................................
  234.     end
  235.     # 对像方动画
  236.     for target in @target_battlers
  237.       target.animation_id = @animation2_id
  238.       target.animation_hit = (target.damage != "Miss")
  239.       #......................................................................
  240.     end
  241.     # 限制动画长度、最低 8 帧
  242.     @wait_count = 8
  243.     # 移至步骤 5
  244.     @phase4_step = 5
  245.   end
  246.   #--------------------------------------------------------------------------
  247.   # ● 刷新画面 (主回合步骤 4 : 对像方动画) ★
  248.   #--------------------------------------------------------------------------
  249.   def update_phase4_step4
  250.     # 限制动画长度、最低 8 帧
  251.     @wait_count = 8
  252.     # 移至步骤 5
  253.     @phase4_step = 5
  254.   end
  255. end
  256. class Game_Actor < Game_Battler
  257.   #--------------------------------------------------------------------------
  258.   # ● 取得战斗画面的 X 坐标
  259.   #--------------------------------------------------------------------------
  260.   def screen_x
  261.     # 返回计算后的队伍 X 坐标的排列顺序
  262.     if self.index != nil
  263.       #......................................................................
  264.       return self.index * 90 + 500
  265.       #......................................................................
  266.     else
  267.       return 0
  268.     end
  269.   end
  270.   #--------------------------------------------------------------------------
  271.   # ● 取得战斗画面的 Y 坐标
  272.   #--------------------------------------------------------------------------
  273.   def screen_y
  274.     #........................................................................
  275.     return 464 - self.index * 110
  276.     #........................................................................
  277.   end
  278.   #--------------------------------------------------------------------------
  279.   # ● 取得战斗画面的 Z 坐标
  280.   #--------------------------------------------------------------------------
  281.   def screen_z
  282.     # 返回计算后的队伍 Z 坐标的排列顺序
  283.     if self.index != nil
  284.       return 4 - self.index
  285.     else
  286.       return 0
  287.     end
  288.   end
  289. end
  290. class Scene_Battle
  291.   #..........................................................................
  292.   #--------------------------------------------------------------------------
  293.   # ● 返回phase
  294.   #--------------------------------------------------------------------------
  295.   def phase
  296.     return @phase
  297.   end
  298.   #--------------------------------------------------------------------------
  299.   # ● 返回phase4_step
  300.   #--------------------------------------------------------------------------
  301.   def phase4_step
  302.     return @phase4_step
  303.   end
  304.   #--------------------------------------------------------------------------
  305.   # ● 返回phase4_step
  306.   #--------------------------------------------------------------------------
  307.   def actor_command_active?
  308.     return @actor_command_window.active
  309.   end
  310.   #..........................................................................
  311. end
  312. class Game_Battler
  313.   #..........................................................................
  314.   #--------------------------------------------------------------------------
  315.   # ● 获取循环的动画 ID
  316.   #--------------------------------------------------------------------------  
  317.   def show_damage(value)
  318.     @show_damage_value = value
  319.   end
  320.   #--------------------------------------------------------------------------
  321.   # ● 获取循环的动画 ID
  322.   #--------------------------------------------------------------------------
  323.   def show_damage_value
  324.     return @show_damage_value
  325.   end
  326.   #--------------------------------------------------------------------------
  327.   # ● 获取循环的动画 ID
  328.   #--------------------------------------------------------------------------
  329.   def battler_ani
  330.     return @battler_ani
  331.   end
  332.   #--------------------------------------------------------------------------
  333.   # ● 获取循环的动画 ID
  334.   #--------------------------------------------------------------------------
  335.   def setup_battler_ani(battler_ani, once = 0)
  336.     @battler_ani = battler_ani
  337.     @once = once
  338.   end
  339.   #--------------------------------------------------------------------------
  340.   # ● 获取循环的动画 ID
  341.   #--------------------------------------------------------------------------
  342.   def setup_battler_hurt_ani(hurt)
  343.     @hurt = hurt
  344.   end  
  345.   #--------------------------------------------------------------------------
  346.   # ● 获取循环的动画 ID
  347.   #--------------------------------------------------------------------------
  348.   def setup_battler_dead_ani(over)
  349.     @over = over
  350.   end
  351.   #--------------------------------------------------------------------------
  352.   # ● 获取循环的动画 ID
  353.   #--------------------------------------------------------------------------
  354.   def battler_dead_ani
  355.     return @over
  356.   end
  357.   #--------------------------------------------------------------------------
  358.   # ● 获取循环的动画 ID
  359.   #--------------------------------------------------------------------------
  360.   def battler_ani_once
  361.     return @once
  362.   end
  363.   #--------------------------------------------------------------------------
  364.   # ● 获取循环的动画 ID
  365.   #--------------------------------------------------------------------------
  366.   def battler_hurt_ani
  367.     return @hurt
  368.   end
  369.   #..........................................................................
  370. end
  371. class Sprite_Battler < RPG::Sprite
  372.   #..........................................................................
  373.   #--------------------------------------------------------------------------
  374.   # ● 胜利图
  375.   #--------------------------------------------------------------------------
  376.   def win
  377.     if @battler_name != nil and not @battler.hidden and not @battler.dead?
  378.       @battler.setup_battler_ani(@battler_name.split(/★/)[6], 1)
  379.     end
  380.   end
  381.   #..........................................................................
  382.   #--------------------------------------------------------------------------
  383.   # ● 释放
  384.   #--------------------------------------------------------------------------
  385.   def dispose
  386.     if self.bitmap != nil
  387.       self.bitmap.dispose
  388.     end
  389.     super
  390.   end
  391.   #--------------------------------------------------------------------------
  392.   # ● 刷新画面
  393.   #--------------------------------------------------------------------------
  394.   def update
  395.     super
  396.     # 战斗者为 nil 的情况下
  397.     if [url=home.php?mod=space&uid=133701]@battler[/url] == nil
  398.       self.bitmap = nil
  399.       loop_animation(nil)
  400.       return
  401.     end
  402.     # 文件名和色相与当前情况有差异的情况下
  403.     if @battler.battler_name != @battler_name or
  404.        @battler.battler_hue != @battler_hue
  405.       @battler_hue = @battler.battler_hue
  406.       # 获取、设置位图
  407.       @battler_name = @battler.battler_name
  408.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  409.       #.......................................................................
  410.       @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  411.       #.......................................................................
  412.       @width = bitmap.width
  413.       [url=home.php?mod=space&uid=291977]@height[/url] = bitmap.height
  414.       self.ox = @width / 2
  415.       self.oy = @height
  416.       # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
  417.       if @battler.is_a?(Game_Enemy)
  418.         if @battler.dead? or @battler.hidden
  419.           self.opacity = 0
  420.         end
  421.       end
  422.     end
  423.     # 动画 ID 与当前的情况有差异的情况下
  424.     #.........................................................................
  425.     if @battler.battler_ani != @battler_ani
  426.       @battler_ani = @battler.battler_ani
  427.       loop_animation($data_animations[@battler_ani.to_i])
  428.     end
  429.     #.........................................................................
  430.     # 应该被显示的角色的情况下
  431.     if @battler.is_a?(Game_Actor) and @battler_visible
  432.       # 不是主状态的时候稍稍降低点透明度
  433.       if $game_temp.battle_main_phase
  434.         self.opacity += 3 if self.opacity < 255
  435.       else
  436.         self.opacity -= 3 if self.opacity > 207
  437.       end
  438.     end
  439.     # 明灭
  440.     if @battler.blink
  441.       blink_on
  442.     else
  443.       blink_off
  444.     end
  445.     # 不可见的情况下
  446.     unless @battler_visible
  447.       # 出现 ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  448.       if not @battler.hidden and not @battler.dead? and
  449.          (@battler.damage == nil or @battler.damage_pop)
  450.         if @battler.is_a?(Game_Enemy)
  451.           appear
  452.         else
  453.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  454.         end
  455.         @battler_visible = true
  456.       end
  457.     end
  458.     # 可见的情况下
  459.     if @battler_visible
  460.       # 逃跑
  461.       if @battler.hidden
  462.         $game_system.se_play($data_system.escape_se)
  463.         escape
  464.         @battler_visible = false
  465.       end
  466.       # 白色闪烁
  467.       if @battler.white_flash
  468.         whiten
  469.         @battler.white_flash = false
  470.       end
  471.       # 动画
  472.       if @battler.animation_id != 0
  473.         animation = $data_animations[@battler.animation_id]
  474.         animation(animation, @battler.animation_hit)
  475.         @battler.animation_id = 0
  476.       end
  477.       # 伤害
  478.       if @battler.damage_pop
  479.         damage(@battler.damage, @battler.critical)
  480.         @battler.damage = nil
  481.         @battler.critical = false
  482.         @battler.damage_pop = false
  483.       end
  484.       # korapusu
  485.       if @battler.damage == nil and @battler.dead?
  486.         #....................................................................
  487.         if @battler.is_a?(Game_Enemy)
  488.           $game_system.se_play($data_system.enemy_collapse_se)
  489.           #collapse
  490.         else
  491.           $game_system.se_play($data_system.actor_collapse_se)
  492.         end
  493.         #....................................................................
  494.         @battler_visible = false
  495.       end
  496.     end
  497.     # 设置活动块的坐标
  498.     self.x = @battler.screen_x
  499.     self.y = @battler.screen_y
  500.     self.z = @battler.screen_z
  501.   end
  502. end
  503. module RPG
  504.   class Sprite < ::Sprite
  505.     def damage(value, critical)
  506.       dispose_damage
  507.       if value.is_a?(Numeric)
  508.         damage_string = value.abs.to_s
  509.       else
  510.         damage_string = value.to_s
  511.       end
  512.       bitmap = Bitmap.new(160, 48)
  513.       bitmap.font.name = "Arial Black"
  514.       bitmap.font.size = 32
  515.       bitmap.font.color.set(0, 0, 0)
  516.       bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
  517.       bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
  518.       bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
  519.       bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
  520.       if value.is_a?(Numeric) and value < 0
  521.         bitmap.font.color.set(176, 255, 144)
  522.       else
  523.         bitmap.font.color.set(255, 255, 255)
  524.       end
  525.       bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
  526.       if critical
  527.         bitmap.font.size = 20
  528.         bitmap.font.color.set(0, 0, 0)
  529.         bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
  530.         bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
  531.         bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
  532.         bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
  533.         bitmap.font.color.set(255, 255, 255)
  534.         bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
  535.       end
  536.       @_damage_sprite = ::Sprite.new(self.viewport)
  537.       @_damage_sprite.bitmap = bitmap
  538.       @_damage_sprite.ox = 80
  539.       @_damage_sprite.oy = 20
  540.       @_damage_sprite.x = self.x
  541.       @_damage_sprite.x -= self.bitmap.width/2 if @battler.is_a?(Game_Actor)
  542.       @_damage_sprite.y = self.y - self.oy / 2
  543.       @_damage_sprite.z = 3000
  544.       @_damage_duration = 40
  545.     end
  546.   end
  547. end
  548. module RPG
  549. #--------------------------------------------------------------------------
  550. # ● 常量设定
  551. #--------------------------------------------------------------------------
  552. # 是否显示总伤害
  553. SHOW_TOTAL_DAMAGE = true
  554. # 角色受攻击时是否跳一下
  555. BATTLER_JUMP = true

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

  1286. #==============================================================================
  1287. # ■ Scene_Battle
  1288. #------------------------------------------------------------------------------
  1289. #  处理战斗画面的类。
  1290. #==============================================================================

  1291. class Scene_Battle
  1292. #--------------------------------------------------------------------------
  1293. # ● 定义实例变量
  1294. #--------------------------------------------------------------------------
  1295. attr_reader   :animation1_id                    # 行动方动画ID
  1296. end
  1297. class Sprite_Battler < RPG::Sprite
  1298.   #--------------------------------------------------------------------------
  1299.   # ● 处理角色动作
  1300.   #--------------------------------------------------------------------------
  1301.   def update_actor_animation
  1302.     if @battler.is_a?(Game_Actor)
  1303.       if @battler.show_damage_value != nil
  1304.         self.damage(@battler.show_damage_value, false)
  1305.         @battler.show_damage(nil)
  1306.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  1307.         @battler.setup_battler_hurt_ani(1)
  1308.       end
  1309.       if @battler.current_action.kind == 0 and @battler.current_action.basic == 1
  1310.       else
  1311.         if @hits == 1 and not @battler.dead? and @battler.battler_hurt_ani != 1 and @battler.damage.is_a?(Numeric) and @battler.damage > 0
  1312.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  1313.           @battler.setup_battler_hurt_ani(1)
  1314.         elsif @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
  1315.           for actor in $game_party.actors
  1316.             if @battler != actor
  1317.               actor.add_state(6)
  1318.             end
  1319.           end
  1320.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  1321.           @battler.setup_battler_dead_ani(1)
  1322.         end
  1323.       end
  1324.     end
  1325.   end
  1326.   #--------------------------------------------------------------------------
  1327.   # ● 处理敌人动作
  1328.   #--------------------------------------------------------------------------
  1329.   def update_enemy_animation
  1330.     if @battler.is_a?(Game_Enemy)
  1331.       if @battler.show_damage_value != nil
  1332.         self.damage(@battler.show_damage_value, false)
  1333.         @battler.show_damage(nil)
  1334.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  1335.         @battler.setup_battler_hurt_ani(1)
  1336.       end
  1337.       if @battler.current_action.kind == 0 and @battler.current_action.basic == 1
  1338.       else
  1339.         if @hits == 1 and not @battler.dead? and @battler.battler_hurt_ani != 1 and @battler.damage.is_a?(Numeric) and @battler.damage > 0
  1340.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  1341.           @battler.setup_battler_hurt_ani(1)
  1342.         elsif @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
  1343.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  1344.           @battler.setup_battler_dead_ani(1)
  1345.           collapse
  1346.         end
  1347.       end
  1348.     end
  1349.   end
  1350. end
复制代码
谢谢了,我的待机动画素材一共六帧

Lv3.寻梦者

梦石
0
星屑
1556
在线时间
626 小时
注册时间
2010-8-5
帖子
451
2
发表于 2014-2-1 17:47:28 | 只看该作者
你在制作动画的时候把一帧图放在两个项就是了

评分

参与人数 1星屑 +50 收起 理由
芯☆淡茹水 + 50 我很赞同

查看全部评分

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3570
在线时间
3064 小时
注册时间
2011-11-17
帖子
980
3
发表于 2014-2-2 00:25:50 | 只看该作者
此类问题有个通用办法 用个time计数
在update 里
@time+=1
@time%=2 假设放慢两倍
dosomething if @time==0
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-30 11:38

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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