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

Project1

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

如果做特效连击总伤害显示

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
65
在线时间
5 小时
注册时间
2006-8-21
帖子
417
跳转到指定楼层
1
发表于 2007-12-27 18:09:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x


就是连击之后显示一个总数

Lv1.梦旅人

梦石
0
星屑
65
在线时间
5 小时
注册时间
2006-8-21
帖子
417
2
 楼主| 发表于 2007-12-27 18:09:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x


就是连击之后显示一个总数

Lv1.梦旅人

梦石
0
星屑
65
在线时间
5 小时
注册时间
2006-8-21
帖子
417
3
 楼主| 发表于 2007-12-27 22:46:22 | 只看该作者
没人知道吗
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
65
在线时间
5 小时
注册时间
2006-8-21
帖子
417
4
 楼主| 发表于 2007-12-28 02:41:16 | 只看该作者
真的没人知道啊?
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2006-9-23
帖子
145
5
发表于 2007-12-28 03:07:24 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
65
在线时间
5 小时
注册时间
2006-8-21
帖子
417
6
 楼主| 发表于 2007-12-28 04:03:04 | 只看该作者
连击一直能用啊,但以前不显示总伤害,今天偶然看见这个游戏里有这个显示总伤害的功能
回复 支持 反对

使用道具 举报

Lv1.梦旅人

Poison·

梦石
0
星屑
50
在线时间
83 小时
注册时间
2007-8-30
帖子
2391
7
发表于 2007-12-28 08:18:24 | 只看该作者
你用得应该是旧版的吧!!!
#==========================================
   # 修改说明:
   # @flash_shake用来制作挨打时候跳跃
   # @_damage    用来记录每次打击之后弹出数字
   # @_total_damage 记录总伤害
   # @_total_damage_duration 总伤害持续帧
   #==========================================
   #alias 66RPG_rainbow_initialize : initialize


  1. =begin
  2. ==============================================================================

  3. 彩虹神剑(伤害分段显示)显示总伤害版 v1.0d

  4. ==============================================================================

  5. 彩虹神剑 -柳柳

  6. 6-20-2006 v1.0 -叶子
  7. 在彩虹神剑的基础上增加了显示总伤害的功能,而且总伤害的数字是弹出伤害时逐渐增加的

  8. v1.0a -叶子
  9. 修正了显示伤害和实际伤害有差别的问题
  10. 修正了miss的情况下显示miss混乱的问题
  11. 修正了对己方技能重复显示伤害的问题
  12. 未修正播放目标动画第一帧时目标有时无端跳动的BUG

  13. v1.0b -叶子
  14. 修改了总伤害数字的位置和z坐标
  15. 未修正播放目标动画第一帧时目标有时无端跳动的BUG

  16. v1.0c -柳柳
  17. ? ? ?

  18. v1.0d -柳柳
  19. 1.0d最终解决了那个闪光问题,还有最末帧伤害多次的算法

  20. 7-24-2006 v1.0e -叶子
  21. 修正全屏幕闪烁弹出伤害错误的问题
  22. 修正连续伤害不会弹出伤害的问题
  23. 仍然未修正播放目标动画第一帧时目标有时无端跳动的BUG

  24. 我鼓起很大勇气才敢动偶像们的脚本的,不知道会不会出问题啊......  -cftx
  25. 修正了总伤害显示
  26. 增加了伤害美化和HIT数显示
  27. 修正了两次音效

  28. ==============================================================================
  29. =end
  30. # 核心的说明:
  31. # damage_pop 不再附带damage()的功能,这个放到animation里面去了

  32. module RPG
  33. #--------------------------------------------------------------------------
  34. # ● 常量设定
  35. #--------------------------------------------------------------------------
  36. # 是否显示总伤害
  37. SHOW_TOTAL_DAMAGE = true
  38. # 角色受攻击时是否跳一下
  39. BATTLER_JUMP = false
  40. # 连续伤害的动画ID
  41. SLIP_DAMAGE_ANIMATION_ID = 105

  42. class Sprite < ::Sprite
  43.    #==========================================
  44.    # 修改说明:
  45.    # @flash_shake用来制作挨打时候跳跃
  46.    # @_damage    用来记录每次打击之后弹出数字
  47.    # @_total_damage 记录总伤害
  48.    # @_total_damage_duration 总伤害持续帧
  49.    #==========================================
  50.    #alias 66RPG_rainbow_initialize : initialize
  51.    
  52.    def initialize(viewport = nil)
  53.      #66RPG_rainbow_initialize(viewport)
  54.      super(viewport)
  55.      @_whiten_duration = 0
  56.      @_appear_duration = 0
  57.      @_escape_duration = 0
  58.      @_collapse_duration = 0
  59.      @_damage_duration = 0
  60.      @_animation_duration = 0
  61.      @_blink = false
  62.      # 挨打时候跳跃
  63.      @flash_shake = 0
  64.      # 伤害记录数组
  65.      @_damage = []
  66.      # 总伤害数字
  67.      @_total_damage = 0
  68.      # 总伤害持续帧
  69.      @_total_damage_duration = 0
  70.      #记录已经发生的伤害的变量★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  71.      @p_dam=0
  72.      @hits=0
  73.    end
  74. #美化的伤害处理★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  75. def damage(value, critical)
  76.       # 释放伤害,效果是伤害数字快速消失,觉得不如不消失好看......
  77.       #dispose_damage
  78.       #清除hit数
  79.       dispose_hit
  80.       # 如果伤害值是数值
  81.       if value.is_a?(Numeric)
  82.         # 绝对值转为字符串
  83.         damage_string = value.abs.to_s
  84.       else
  85.         # 转为字符串
  86.         damage_string = value.to_s
  87.       end
  88.       # 初始化位图
  89.       bitmap = Bitmap.new(162, 64)
  90.       bitmap.font.name = ["黑体","华文行楷", "宋体"]
  91.       bitmap.font.size = 32
  92.       # 伤害值是数值的情况下
  93.       if value.is_a?(Numeric)
  94.         # 分割伤害值字符串
  95.         damage_array = damage_string.scan(/./)
  96.         damage_x = 81 - damage_string.size * 9
  97.         # 伤害值为负的情况下
  98.         if value < 0
  99.           # 调用回复数字表
  100.           rect_y = 32
  101.         else
  102.           # 调用伤害数字表
  103.           rect_y = 0
  104.         end
  105.         # 循环伤害值字符串
  106.         for char in damage_array
  107.           number = char.to_i
  108.           # 显示伤害数字
  109.           bitmap.blt(damage_x, 32, RPG::Cache.picture("Damage"),
  110.           Rect.new(number * 18, rect_y, 18, 32))
  111.           # 后移一位
  112.           damage_x += 18
  113.         end
  114.       # 伤害值不是数值的情况
  115.       else
  116.         # 如果伤害值不是 Miss
  117.         unless value == "Miss"
  118.           # 系统默认描画字符串
  119.           bitmap.font.color.set(0, 0, 0)
  120.           bitmap.draw_text(-1, 27, 162, 36, damage_string, 1)
  121.           bitmap.draw_text(+1, 27, 162, 36, damage_string, 1)
  122.           bitmap.draw_text(-1, 29, 162, 36, damage_string, 1)
  123.           bitmap.draw_text(+1, 29, 162, 36, damage_string, 1)
  124.           bitmap.font.color.set(255, 255, 255)
  125.           bitmap.draw_text(0, 28, 162, 36, damage_string, 1)
  126.         # Miss 的情况下
  127.         else
  128.           # 显示未击中图画
  129.           bitmap.blt(36, 28, RPG::Cache.picture("Damage"), Rect.new(90, 64, 90, 32))
  130.         end
  131.       end
  132.       # 会心一击标志打开的情况
  133.       if critical
  134.         # 显示会心一击图画
  135.         bitmap.blt(36, 0, RPG::Cache.picture("Damage"), Rect.new(0, 64, 90, 32))
  136.       end
  137.       # 伤害值定位
  138.       @_damage_sprite = ::Sprite.new(self.viewport)
  139.       @_damage_sprite.bitmap = bitmap
  140.       @_damage_sprite.ox = 81
  141.       @_damage_sprite.oy = 20
  142.       @_damage_sprite.x = self.x
  143.       @_damage_sprite.y = self.y - self.oy / 2
  144.       @_damage_sprite.z = 3000
  145.       @_damage_duration = 40
  146.       @_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
  147.       make_total_damage(value)  

  148.     end

  149. #   ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  150. # hit数的美化描绘
  151.     def hit

  152.       # 如果伤害值是数值
  153.       # 转为字符串
  154.       value=@hits
  155.         hits_string = value.to_s
  156.       # 初始化位图
  157.        bitmap = Bitmap.new(320, 64)
  158.        bitmap.font.name = "Arial Black"
  159.        bitmap.font.size = 32
  160.        # 分割伤害值字符串
  161.         hits_array = hits_string.scan(/./)
  162.         hits_x = 81 - hits_string.size * 18.1
  163.           rect_y = 0
  164.         # 循环伤害值字符串
  165.         for char in hits_array
  166.           number = char.to_i
  167.           # 显示伤害数字
  168.           bitmap.blt(hits_x, 0, RPG::Cache.picture("Number"),
  169.           Rect.new(number * 36.2, rect_y, 36.2, 50))
  170.           # 后移一位
  171.           hits_x += 36.2
  172.         end
  173.         bitmap.blt(hits_x, 0, RPG::Cache.picture("HITS"),
  174.         Rect.new(0, -21, 90, 50))

  175.       # 伤害值定位
  176.       @_hits_sprite = ::Sprite.new(self.viewport)
  177.       @_hits_sprite.bitmap = bitmap
  178.       @_hits_sprite.ox = 81
  179.       @_hits_sprite.oy = 20
  180.       @_hits_sprite.x = 500
  181.       @_hits_sprite.y = 100
  182.       @_hits_sprite.z = 3000
  183.       @_hits_duration = 40
  184.     end
  185. #--------------------------------------------------------------------------
  186.    # ● 总伤害处理
  187.    #--------------------------------------------------------------------------
  188.    def make_total_damage(value)
  189.      if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE
  190.        @_total_damage += value
  191.         # 绝对值转为字符串
  192.         damage_string = @_total_damage.abs.to_s
  193.       else
  194.         return
  195.       end
  196.       # 初始化位图
  197.       bitmap = Bitmap.new(300, 150)
  198.       bitmap.font.name = "Arial Black"
  199.       bitmap.font.size = 32
  200.       # 伤害值是数值的情况下
  201.       if value.is_a?(Numeric)
  202.         # 分割伤害值字符串
  203.         damage_array = damage_string.scan(/./)
  204.         damage_x = 40 - damage_string.size * 9
  205.         # 伤害值为负的情况下
  206.         if value < 0
  207.           # 调用回复数字表
  208.           name="Number3"
  209.         else
  210.           # 调用伤害数字表
  211.           name="Number2"
  212.         end
  213.         # 循环伤害值字符串
  214.         for char in damage_array
  215.           number = char.to_i
  216.           # 显示伤害数字
  217.           bitmap.blt(damage_x, 0, RPG::Cache.picture(name),
  218.           Rect.new(number * 36.2, 0, 36.2, 50))
  219.           # 后移一位
  220.           damage_x += 36.2
  221.         end
  222.       end
  223.       
  224.       
  225.         
  226.         
  227. #     if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE
  228. #       @_total_damage += value
  229. #     else
  230. #       return
  231. #     end
  232. #     bitmap = Bitmap.new(300, 150)
  233. #     bitmap.font.name = "Arial Black"
  234. #     bitmap.font.size = 40
  235. #     bitmap.font.color.set(0, 0, 0)
  236. #     bitmap.draw_text(+2, 12+2, 160, 40, @_total_damage.abs.to_s, 1)
  237. #     if @_total_damage < 0
  238. #       bitmap.font.color.set(80, 255, 00)
  239. #    else
  240. #       bitmap.font.color.set(255, 140, 0)
  241. #     end
  242. #     bitmap.draw_text(0, 12, 160, 40, @_total_damage.abs.to_s, 1)
  243. #     bitmap.font.color.set(55, 55,255)
  244.      
  245.      
  246.      if @_total_damage_sprite.nil?
  247.        @_total_damage_sprite = ::Sprite.new(self.viewport)
  248.        @_total_damage_sprite.ox = 80
  249.        @_total_damage_sprite.oy = 20
  250.        @_total_damage_sprite.z = 3000

  251.      end
  252.      @_total_damage_sprite.bitmap = bitmap
  253.      @_total_damage_sprite.zoom_x = 0.8
  254.      @_total_damage_sprite.zoom_y = 0.8
  255.      @_total_damage_sprite.x = self.x
  256.      @_total_damage_sprite.y = self.y  - self.oy / 2 - 64
  257.      @_total_damage_sprite.z = 3001
  258.      @_total_damage_duration = 80
  259.      #hit数描绘
  260.      @hits+=1
  261.     if @_total_damage > 0
  262.       hit
  263.     end
  264.    end


  265.    def animation(animation, hit, battler_damage="", battler_critical=false)
  266.      dispose_animation      
  267.      #=======================================
  268.      # 修改:记录伤害和critical
  269.      #=======================================
  270.      @battler_damage = battler_damage
  271.      @battler_critical = battler_critical
  272.      @_animation = animation
  273.      return if @_animation == nil
  274.      @_animation_hit = hit
  275.      @_animation_duration = @_animation.frame_max
  276.      animation_name = @_animation.animation_name
  277.      animation_hue = @_animation.animation_hue
  278.      bitmap = RPG::Cache.animation(animation_name, animation_hue)
  279.      #=======================================
  280.      # 修改:计算总闪光权限值
  281.      #=======================================
  282.      for timing in @_animation.timings
  283.        quanzhong = animation_process_timing(timing, @_animation_hit,true)
  284.        @all_quanzhong += quanzhong
  285.        # 记录最后一次闪光
  286.        @_last_frame = timing.frame if quanzhong != 0
  287.      end      
  288.      if @@_reference_count.include?(bitmap)
  289.        @@_reference_count[bitmap] += 1
  290.      else
  291.        @@_reference_count[bitmap] = 1
  292.      end
  293.      #=======================================
  294.      # 修改:行动方动画不显示伤害
  295.      #=======================================
  296.      if $scene.is_a?(Scene_Battle)
  297.        if $scene.animation1_id == @battler.animation_id
  298.          @battler_damage = ""
  299.        end
  300.      end
  301.      @_animation_sprites = []
  302.      if @_animation.position != 3 or not @@_animations.include?(animation)
  303.        for i in 0..15
  304.          sprite = ::Sprite.new(self.viewport)
  305.          sprite.bitmap = bitmap
  306.          sprite.visible = false
  307.          @_animation_sprites.push(sprite)
  308.        end
  309.        unless @@_animations.include?(animation)
  310.          @@_animations.push(animation)
  311.        end
  312.      end
  313.      update_animation
  314.   end
  315.    #=======================================
  316.    # 修改:更换清除伤害的算法,以防万一
  317.    #       本内容在脚本中没有使用过
  318.    #=======================================
  319.    def dispose_damage
  320.      for damage in @_damage.reverse
  321.        damage[0].bitmap.dispose
  322.        damage[0].dispose
  323.        @_damage.delete(damage)
  324.      end
  325.      @_total_damage = 0
  326.      @_last_frame = -1
  327.      if @_total_damage_sprite != nil
  328.        @_total_damage_duration = 0
  329.        @_total_damage_sprite.bitmap.dispose
  330.        @_total_damage_sprite.dispose
  331.        @_total_damage_sprite = nil
  332.      end
  333.    end
  334.    #=======================================
  335.    # 清除hit数★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  336.    #=======================================
  337.    def dispose_hit
  338.      if @_hits_sprite != nil
  339.        @_hits_sprite.bitmap.dispose
  340.        @_hits_sprite.dispose
  341.        @_hits_sprite = nil
  342.      end
  343.    end
  344.    def dispose_animation
  345.      #=======================================
  346.      # 修改:清除记录的伤害,清除权重记录
  347.      #=======================================
  348.      @battler_damage = nil
  349.      @battler_critical = nil
  350.      @all_quanzhong = 1
  351.      @_total_damage = 0
  352.      @_last_frame = -1
  353.      if @_animation_sprites != nil
  354.        sprite = @_animation_sprites[0]
  355.        if sprite != nil
  356.          @@_reference_count[sprite.bitmap] -= 1
  357.          if @@_reference_count[sprite.bitmap] == 0
  358.            sprite.bitmap.dispose
  359.          end
  360.        end
  361.        for sprite in @_animation_sprites
  362.          sprite.dispose
  363.        end
  364.        @_animation_sprites = nil
  365.        @_animation = nil
  366.      end
  367.    end
  368.    def update
  369.      super
  370.      if @_whiten_duration > 0
  371.        @_whiten_duration -= 1
  372.        self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  373.      end
  374.      if @_appear_duration > 0
  375.        @_appear_duration -= 1
  376.        self.opacity = (16 - @_appear_duration) * 16
  377.      end
  378.      if @_escape_duration > 0
  379.        @_escape_duration -= 1
  380.        self.opacity = 256 - (32 - @_escape_duration) * 10
  381.      end
  382.      if @_collapse_duration > 0
  383.        @_collapse_duration -= 1
  384.        self.opacity = 256 - (48 - @_collapse_duration) * 6
  385.      end
  386.      #=======================================
  387.      # 修改:更新算法,更新弹出
  388.      #=======================================
  389.      if @_damage_duration > 0
  390.        @_damage_duration -= 1
  391.        for damage in @_damage
  392.          damage[0].x = self.x + self.viewport.rect.x -
  393.                        self.ox + self.src_rect.width / 2 +
  394.                        (40 - damage[1]) * damage[3] / 10
  395.          damage[0].y -= damage[4]+damage[1]/10
  396.          damage[0].opacity = damage[1]*20
  397.          damage[1] -= 1
  398.          if damage[1]==0
  399.            damage[0].bitmap.dispose
  400.            damage[0].dispose
  401.            @_damage.delete(damage)

  402.            next
  403.          end
  404.        end
  405.      end
  406.      #=======================================
  407.      # 添加:弹出总伤害
  408.      #=======================================
  409.      if @_total_damage_duration > 0
  410.        @_total_damage_duration -= 1
  411.        @_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
  412.        if @_total_damage_sprite.zoom_x > 1.0
  413.          @_total_damage_sprite.zoom_x -= 0.05
  414.        end
  415.        if @_total_damage_sprite.zoom_y > 1.0
  416.          @_total_damage_sprite.zoom_y -= 0.05
  417.        end
  418.        @_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
  419.        if @_total_damage_duration <= 0
  420.          dispose_hit#★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  421.          @_total_damage = 0
  422.          @_total_damage_duration = 0
  423.          @_total_damage_sprite.bitmap.dispose
  424.          @_total_damage_sprite.dispose
  425.          @_total_damage_sprite = nil
  426.        end
  427.      end
  428.      #=======================================
  429.      if @_animation != nil and (Graphics.frame_count % 2 == 0)
  430.        @_animation_duration -= 1
  431.        update_animation
  432.      end
  433.      if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  434.        update_loop_animation
  435.        @_loop_animation_index += 1
  436.        @_loop_animation_index %= @_loop_animation.frame_max
  437.      end
  438.      if @_blink
  439.        @_blink_count = (@_blink_count + 1) % 32
  440.        if @_blink_count < 16
  441.          alpha = (16 - @_blink_count) * 6
  442.        else
  443.          alpha = (@_blink_count - 16) * 6
  444.        end
  445.        self.color.set(255, 255, 255, alpha)
  446.      end
  447.      @@_animations.clear
  448.    end
  449.    def update_animation
  450.     if @_animation_duration > 0
  451.        frame_index = @_animation.frame_max - @_animation_duration
  452.        cell_data = @_animation.frames[frame_index].cell_data
  453.        position = @_animation.position
  454.        animation_set_sprites(@_animation_sprites, cell_data, position)
  455.        #=======================================
  456.        # 修改:弹出伤害,权重计算
  457.        #=======================================
  458.        for timing in @_animation.timings
  459.          if timing.frame == frame_index
  460.            t = 1.0 * animation_process_timing(timing, @_animation_hit)  
  461.                    if timing.se.name != ""
  462.           se=timing.se
  463.           Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
  464.         end
  465.            #p t,"当前权重", @all_quanzhong,"总权重"
  466.            if @battler_damage.is_a?(Numeric) and t != 0
  467.              t *= @battler_damage
  468.              t /= @all_quanzhong
  469.              t = t.to_i
  470.              #在闪光不是最后一次的情况下,把这次伤害加入到已经发生的伤害中★★★★★★★★★★★★★★★★★★★★★★★★★★
  471.              if frame_index != @_last_frame
  472.              @p_dam+= t
  473.              end
  474.              #p @p_dam,"已发生伤害",@battler_damage,"总伤害"(调试用)★★★★★★★★★★★★★★★★★★★★★★★★★★
  475.              #闪光为最后一次的情况下,改变这次伤害的计算方法(总伤害-已经发生伤害)★★★★★★★★★★★★★★★★★★★★★★★★★★
  476.              if frame_index == @_last_frame
  477.                t=@battler_damage-@p_dam
  478.              end
  479.              #p t,"当前伤害",@battler_damage,"总伤害"
  480.              # 最后一次闪光的话,伤害修正
  481.              if frame_index == @_last_frame
  482.                @_total_damage = @battler_damage - t
  483.                @p_dam=0      #已经发生的伤害归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  484.             end
  485.              #p t,@battler_damage,@all_quanzhong
  486.              damage(t,@battler_critical)
  487.             #连击次数归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  488.             if frame_index == @_last_frame
  489.                       @hits=0  
  490.             end
  491.            # 防止重复播放miss
  492.            elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
  493.              damage(@battler_damage,@battler_critical)
  494.            end
  495.          end
  496.        end
  497.      else
  498.        dispose_animation
  499.      end
  500.    end
  501.    #=======================================
  502.    # 修改:敌人跳跃的功能 + 添加返回数值
  503.    #=======================================
  504.     def animation_process_timing(timing, hit,dontflash=false)
  505.       if (timing.condition == 0) or
  506.          (timing.condition == 1 and hit == true) or
  507.          (timing.condition == 2 and hit == false)
  508.         case timing.flash_scope
  509.         when 1
  510.           unless dontflash
  511.             self.flash(timing.flash_color, timing.flash_duration * 2)
  512.             if @_total_damage >0
  513.               @flash_shake_switch = true
  514.               @flash_shake = 10
  515.             end
  516.           end
  517.           return timing.flash_color.alpha * timing.flash_duration
  518.         when 2
  519.           unless dontflash
  520.             if self.viewport != nil
  521.               self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
  522.             end
  523.           end
  524.           return timing.flash_color.alpha * timing.flash_duration
  525.         when 3
  526.           unless dontflash
  527.             self.flash(nil, timing.flash_duration * 2)
  528.           end
  529.           return timing.flash_color.alpha * timing.flash_duration
  530.         end
  531.       end      
  532.       return 0
  533.     end   
  534. end
  535. end
  536. #==============================================================================
  537. # ■ Sprite_Battler
  538. #==============================================================================
  539. class Sprite_Battler < RPG::Sprite
  540. #--------------------------------------------------------------------------
  541. # ● 初始化对像
  542. #    添加跳跃记录
  543. #--------------------------------------------------------------------------
  544. def initialize(viewport, battler = nil)
  545.   super(viewport)
  546.   @battler = battler
  547.   @battler_visible = false
  548.   @flash_shake_switch = true
  549.      #★★★★★★★★★★★★
  550.   @nx = 0
  551.   @xbit = 0
  552.    #★★★★★★★★★★★★
  553. end
  554. #--------------------------------------------------------------------------
  555. # ● 刷新画面
  556. #    增添跳跃功能
  557. #--------------------------------------------------------------------------
  558. def update
  559.   super
  560.   # 战斗者为 nil 的情况下
  561.   if @battler == nil
  562.     self.bitmap = nil
  563.     loop_animation(nil)
  564.     return
  565.   end
  566.   # 文件名和色相与当前情况有差异的情况下
  567.    if @battler.battler_name != @battler_name or
  568.       @battler.battler_hue != @battler_hue
  569.      # 获取、设置位图
  570.      @battler_name = @battler.battler_name
  571.      @battler_hue = @battler.battler_hue
  572.      self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  573.      @width = bitmap.width
  574.      @height = bitmap.height
  575.      self.ox = @width / 2
  576.      self.oy = @height
  577.      # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
  578.      if @battler.dead? or @battler.hidden
  579.        self.opacity = 0
  580.      end
  581.    end
  582.    if @battler.is_a?(Game_Actor)
  583.      @nx += 1
  584.      @nx %= 40 #每帧+1,40帧一个循环
  585.      @xbit = @nx / 10 * self.bitmap.width/4 #获得当前的图像坐标
  586.      self.src_rect.set(@xbit, 0, self.bitmap.width/4, self.bitmap.height) #设置当前战斗图的图像
  587.    end
  588.   # 动画 ID 与当前的情况有差异的情况下
  589.   if @battler.damage == nil and
  590.      @battler.state_animation_id != @state_animation_id
  591.     @state_animation_id = @battler.state_animation_id
  592.     loop_animation($data_animations[@state_animation_id])
  593.   end
  594.   # 应该被显示的角色的情况下
  595.   if @battler.is_a?(Game_Actor) and @battler_visible
  596.     # 不是主状态的时候稍稍降低点透明度
  597.     if $game_temp.battle_main_phase
  598.       self.opacity += 3 if self.opacity < 255
  599.     else
  600.       self.opacity -= 3 if self.opacity > 207
  601.     end
  602.   end
  603.   # 明灭
  604.   if @battler.blink
  605.     blink_on
  606.   else
  607.     blink_off
  608.   end
  609.   # 不可见的情况下
  610.   unless @battler_visible
  611.     # 出现
  612.     if not @battler.hidden and not @battler.dead? and
  613.        (@battler.damage == nil or @battler.damage_pop)
  614.       appear
  615.       @battler_visible = true
  616.     end
  617.   end
  618.   # 可见的情况下
  619.   if @battler_visible
  620.     # 逃跑
  621.     if @battler.hidden
  622.       $game_system.se_play($data_system.escape_se)
  623.       escape
  624.       @battler_visible = false
  625.     end
  626.     # 白色闪烁
  627.     if @battler.white_flash
  628.       whiten
  629.       @battler.white_flash = false
  630.     end
  631.     # 动画
  632.     if @battler.animation_id != 0
  633.       animation = $data_animations[@battler.animation_id]
  634.       animation(animation, @battler.animation_hit,@battler.damage, @battler.critical)
  635.       @battler.animation_id = 0
  636.     end
  637.     # 伤害
  638.     if @battler.damage_pop
  639.       @battler.damage = nil
  640.       @battler.critical = false
  641.       @battler.damage_pop = false
  642.     end
  643.     # korapusu
  644.     if @battler.damage == nil and @battler.dead?
  645.       if @battler.is_a?(Game_Enemy)
  646.         $game_system.se_play($data_system.enemy_collapse_se)
  647.       else
  648.         $game_system.se_play($data_system.actor_collapse_se)
  649.       end
  650.       collapse
  651.       @battler_visible = false
  652.     end
  653.   end
  654.   # 设置活动块的坐标
  655.   if @flash_shake_switch == true
  656.     self.x = @battler.screen_x
  657.     self.y = @battler.screen_y
  658.     self.z = @battler.screen_z
  659.     @flash_shake_switch = false
  660.   end
  661.   if @flash_shake != 0 and @battler.damage != nil and RPG::BATTLER_JUMP
  662.     case @flash_shake
  663.     when 9..10
  664.       self.x = @battler.screen_x
  665.       self.y -=4
  666.       self.z = @battler.screen_z
  667.     when 6..8
  668.       self.x = @battler.screen_x
  669.       self.y -=2
  670.       self.z = @battler.screen_z
  671.     when 3..5
  672.       self.x = @battler.screen_x
  673.       self.y +=2
  674.       self.z = @battler.screen_z
  675.     when 2
  676.       self.x = @battler.screen_x
  677.       self.y += 4
  678.       self.z = @battler.screen_z
  679.     when 1
  680.       self.x = @battler.screen_x
  681.       self.y = @battler.screen_y
  682.       self.z = @battler.screen_z
  683.     end
  684.     @flash_shake -= 1
  685.   end
  686. end
  687. end

  688. #==============================================================================
  689. # ■ Scene_Battle
  690. #------------------------------------------------------------------------------
  691. #  处理战斗画面的类。
  692. #==============================================================================

  693. class Scene_Battle
  694. #--------------------------------------------------------------------------
  695. # ● 定义实例变量
  696. #--------------------------------------------------------------------------
  697. attr_reader   :animation1_id                    # 行动方动画ID
  698. end

  699. #==============================================================================
  700. # ■ Game_Battler
  701. #------------------------------------------------------------------------------
  702. #  处理战斗者的类。这个类作为 Game_Actor 类与 Game_Enemy 类的
  703. # 超级类来使用。
  704. #==============================================================================

  705. #class Game_Battler
  706. #  #--------------------------------------------------------------------------
  707. #  # ● 应用连续伤害效果
  708. #  #--------------------------------------------------------------------------
  709. #  alias rainbow_sword_slip_damage_effect slip_damage_effect
  710. #  def slip_damage_effect
  711. #    self.animation_id = RPG::SLIP_DAMAGE_ANIMATION_ID
  712. #    self.animation_hit = true
  713. #    rainbow_sword_slip_damage_effect
  714. #  end
  715. #end
复制代码



相关的图片http://rpg.blue/upload_program/files/shanghaiPictures.rar
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
65
在线时间
5 小时
注册时间
2006-8-21
帖子
417
8
 楼主| 发表于 2007-12-28 16:18:37 | 只看该作者
怎么用?我用的是RTAB0.17,请问往哪插?
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-19 17:56

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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