扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 104|回复: 0

[转载发布] 让RM中的动画倒着放

[复制链接]
累计送礼:
0 个
累计收礼:
0 个
  • TA的每日心情
    开心
    昨天 18:01
  • 签到天数: 114 天

    连续签到: 4 天

    [LV.6]常住居民II

    2338

    主题

    403

    回帖

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    6
    卡币
    10622
    OK点
    16
    推广点
    0
    同能卷
    0
    积分
    13391

    灌水之王

    发表于 2024-4-19 18:19:41 | 显示全部楼层 |阅读模式
    你是否为了出招的启动、收招的倒回而烦恼?

    你是否想表现一种“时光倒流”的效果?

    你是否想制作出“收回”法术的特效?

    那么,现在你不用分别为两种效果单独制作动画了,一个开关就搞定!

    外挂脚本如下:

    $正反控制开关 = 1

    module RPG
      class Sprite < ::Sprite
        def animation(animation, hit)
          dispose_animation
          @_animation = animation
          return if @_animation == nil
          @_animation_hit = hit
          @_animation_duration = $game_switches[$正反控制开关] ? 1 : @_animation.frame_max
          animation_name = @_animation.animation_name
          animation_hue = @_animation.animation_hue
          bitmap = RPG::Cache.animation(animation_name, animation_hue)
          if @@_reference_count.include?(bitmap)
            @@_reference_count[bitmap] += 1
          else
            @@_reference_count[bitmap] = 1
          end
          @_animation_sprites = []
          if @_animation.position != 3 or not @@_animations.include?(animation)
            for i in 0..15
              sprite = ::Sprite.new(self.viewport)
              sprite.bitmap = bitmap
              sprite.visible = false
              @_animation_sprites.push(sprite)
            end
            unless @@_animations.include?(animation)
              @@_animations.push(animation)
            end
          end
          update_animation
        end
        def loop_animation(animation)
          return if animation == @_loop_animation
          dispose_loop_animation
          @_loop_animation = animation
          return if @_loop_animation == nil
          @_loop_animation_index = $game_switches[$正反控制开关] ? @_loop_animation.frame_max : 1
          animation_name = @_loop_animation.animation_name
          animation_hue = @_loop_animation.animation_hue
          bitmap = RPG::Cache.animation(animation_name, animation_hue)
          if @@_reference_count.include?(bitmap)
            @@_reference_count[bitmap] += 1
          else
            @@_reference_count[bitmap] = 1
          end
          @_loop_animation_sprites = []
          for i in 0..15
            sprite = ::Sprite.new(self.viewport)
            sprite.bitmap = bitmap
            sprite.visible = false
            @_loop_animation_sprites.push(sprite)
          end
          update_loop_animation
        end
        def update
          super
          if @_whiten_duration > 0
            @_whiten_duration -= 1
            self.color.alpha = 128 - (16 - @_whiten_duration) * 10
          end
          if @_appear_duration > 0
            @_appear_duration -= 1
            self.opacity = (16 - @_appear_duration) * 16
          end
          if @_escape_duration > 0
            @_escape_duration -= 1
            self.opacity = 256 - (32 - @_escape_duration) * 10
          end
          if @_collapse_duration > 0
            @_collapse_duration -= 1
            self.opacity = 256 - (48 - @_collapse_duration) * 6
          end
          if @_damage_duration > 0
            @_damage_duration -= 1
            case @_damage_duration
            when 38..39
              @_damage_sprite.y -= 4
            when 36..37
              @_damage_sprite.y -= 2
            when 34..35
              @_damage_sprite.y += 2
            when 28..33
              @_damage_sprite.y += 4
            end
            @_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32
            if @_damage_duration == 0
              dispose_damage
            end
          end
          if @_animation != nil and (Graphics.frame_count % 2 == 0)
            if $game_switches[$正反控制开关]
              @_animation_duration += 1
            else
              @_animation_duration -= 1
            end
            update_animation
          end
          if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
            update_loop_animation
            if $game_switches[$正反控制开关]
              @_loop_animation_index -= 1
              if @_loop_animation_index < 0
                @_loop_animation_index = @_loop_animation.frame_max - 1
              end
            else
              @_loop_animation_index += 1
              @_loop_animation_index %= @_loop_animation.frame_max
            end
          end
          if @_blink
            @_blink_count = (@_blink_count + 1) % 32
            if @_blink_count < 16
              alpha = (16 - @_blink_count) * 6
            else
              alpha = (@_blink_count - 16) * 6
            end
            self.color.set(255, 255, 255, alpha)
          end
          @@_animations.clear
        end
        def update_animation
          continueflag = true
          if $game_switches[$正反控制开关]
            if @_animation_duration > @_animation.frame_max
              continueflag = false
            end
          else
            if @_animation_duration

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2025-3-15 00:42 , Processed in 0.061915 second(s), 54 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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