じ☆ve冰风 发表于 2024-4-19 23:54:46

同时显示多个动画(可以重叠) 2.17更新

截图

工程截图

事件截图(第二张图有点问题,不过影响不大。)


地图效果,多动画(可以重叠)

地图效果,"全屏动画只显示一次"


战斗(附加了状态)


使用还原后


脚本


基础

RUBY 代码
classRPG::Sprite < ::Sprite
def initialize(viewport = nil)
    super(viewport)
    @_whiten_duration = 0
    @_appear_duration = 0
    @_escape_duration = 0
    @_collapse_duration = 0
    @_damage_duration = 0
    #@_animation_duration = 0
    @_blink = false
    @_animation = []
    @_animation_hit = []
    @_animation_duration = []
    @_animation_sprites = []
    @_loop_animation = []
    @_loop_animation_sprites = []
    @_loop_animation_index = []
end
def animation(animation, hit)
    #dispose_animation
    returnif animation == nil
    @_animation0
      @_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
      when38..39
      @_damage_sprite.y -= 4
      when36..37
      @_damage_sprite.y -= 2
      when34..35
      @_damage_sprite.y += 2
      when28..33
      @_damage_sprite.y += 4
      end
      @_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32
      if@_damage_duration == 0
      dispose_damage
      end
    end
    if@_animation.size > 0and(Graphics.frame_count % 2 == 0)
      for i in0...@_animation_duration.size
      @_animation_duration -= 1
      end
      update_animation
    end
    if@_loop_animation.size > 0and(Graphics.frame_count % 2 == 0)
      update_loop_animation
      for i in0...@_loop_animation_index.size
      @_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
    for i in0...@_animation_duration.size
      if@_animation_duration
页: [1]
查看完整版本: 同时显示多个动画(可以重叠) 2.17更新