Module Animation Plus Do RaiseField

29 de janeiro de 2014
Module Animation Plus Do RaiseField

Module Animation Plus é um script desenvolvido pelo RaiseField em 2006 para o RPG Maker XP.

Nós não sabemos para exatamente o que ele serve, visto que os comentários estão todos em japonês, porém ele pode ser necessário para rodar algum outro script ou coisa do tipo, por isso vamos adicionar aqui.

Segue o código:

#--------------------------------------------------------------------------
# ・痰・盗o盗g盗痿安ー盗G盗t盗F盗N盗g
#
#    (C) copyright by RaiseField     Date 2006/09/28    Ver 1.00
#--------------------------------------------------------------------------
# 貼奪痿囃)盗o盗g盗痿安ー痿囃O盗A盗j盗・・[盗V盗痿‘・痿囃,・淡痿庵眼~安高€囁ァ痿囃F"速痿囁ァ痿囁オ痿囁サ痿囃?痿囃,痿囃@痿囃,
#--------------------------------------------------------------------------

module ANIMATION_PLUS
  #--------------------------------------------------------------------------
  # ・・ 盗J盗X盗^盗}盗C盗Y窓痼・€湯:
  #--------------------------------------------------------------------------

  # 盗V盗F盗C盗N痿囃O貼g痿廃痿囁オ痿囃H痿囁ァ
  USE_SHAKE = true
  # 痿庵可]・E総達痿安・遜"]痿囃O貼g痿廃痿囁オ痿囃H痿囁ァ
  USE_TURNING = false
  # 窓其痿・"遜"]痿囃O貼g痿廃痿囁オ痿囃H痿囁ァ
  USE_REVERSE = true
  # ・・"速痿囃O貼g痿廃痿囁オ痿囃H痿囁ァ
  USE_MOVING = false
  # "嘆窓s痿囃O貼g痿廃痿囁オ痿囃H痿囁ァ
  USE_FLY    = true
  # 貼c'・痿囃O貼g痿廃痿囁オ痿囃H痿囁ァ
  USE_SHADOW = true
  # 盗A盗j盗・'・痿庵≪~囃O貼g痿廃痿囁オ痿囃H痿囁ァ
  USE_ADD_ANIME = false
  
  #--------------------------------------------------------------------------
  # ・・ 盗_盗・・[盗W貼転痿囃,盗V盗F盗C盗N綜・'竪
  #--------------------------------------------------------------------------
  DAMAGE_SHAKE_POWER = 8          # 痿溝№€囁ア
  DAMAGE_SHAKE_SPEED = 5          # '測痿囁ア
  DAMAGE_SHAKE_DURATION = 7      # 貼転邸・
    
  #--------------------------------------------------------------------------
  # ・・ 盗V盗F盗C盗N綜・'竪
  #--------------------------------------------------------------------------
  SHAKE_FILE = "盗V盗F盗C盗N"  # 盗t盗@盗C盗痿高€淘コ
  # 痿溝№€囁ア・@red 
  # '測痿囁ア・@blue
  # 貼転邸・  green
  #--------------------------------------------------------------------------
  # ・・ 総達痿安・遜"]痿囃,綜・'竪
  #--------------------------------------------------------------------------
  UPSIDE_DOWN_FILE = "総達痿安・遜"]" # 盗t盗@盗C盗痿高€淘コ
  #--------------------------------------------------------------------------
  # ・・ 窓其痿・"遜"]痿囃,綜・'竪
  #--------------------------------------------------------------------------
  REVERSE_FILE = "窓其痿・"遜"]" # 盗t盗@盗C盗痿高€淘コ
  #--------------------------------------------------------------------------
  # ・・ 痿庵可]痿囃,綜・'竪
  #--------------------------------------------------------------------------
  TURNING_FILE = "痿庵可]" # 盗t盗@盗C盗痿高€淘コ
  # 痿・仕鋳[  ・@red  ・i0."遜貼転・v痿庵奄€囃G,痿囁ケ痿囃I・・邸O.貼転・v痿庵奄€囃G)
  # '測痿囁ア  ・@blue
  # 痿庵可]綜"  green
  #--------------------------------------------------------------------------
  # ・・ ・・"速痿囃,綜・'竪
  #--------------------------------------------------------------------------
  MOVE_FILE = "・・"速"         # 盗t盗@盗C盗痿高€淘コ
  # ・続痿囃,・・'u痿囁ァ痿囃F痿囃,'邸'・窓・痿ゞx  red   0 => -1280 , 128 => 0 , 255 => +1280
  # ・続痿囃,・・'u痿囁ァ痿囃F痿囃,'邸'・窓・痿ゞy  blue  0 => -1280 , 128 => 0 , 255 => +1280
  # '測痿囁ア・@・@・@・@・@・@・@       green
  # ・続痿囃,・・'u痿囃)痿湯?痿囃H痿囁ァ・H       alpha  (0.痿湯?痿囃F痿囃(痿囁,痿囁ケ痿囃I・・邸O.痿湯?痿囃H)
  #--------------------------------------------------------------------------
  # ・・ 盗A盗j盗・'・痿庵≪~囃,綜・'竪
  #--------------------------------------------------------------------------
  ADD_ANIME_FILE = "盗A盗j盗・'・痿庵・  # 盗t盗@盗C盗痿高€淘コ
  # 盗A盗j盗・・[盗V盗痿‘・ID        red + blue + green
end

module ANIMATION_PLUS
  #--------------------------------------------------------------------------
  # ・・ 盗I盗u盗W盗F盗N盗g総痿暗炭痿安鹿
  #--------------------------------------------------------------------------
  def initialize(*arg)
    super(*arg)
    @_effect_ox = 0
    @_effect_oy = 0
  end
  
  def update(*arg)
    # 盗G盗t盗F盗N盗g・淡痿庵眼~囃,"K痿廃
    update_effect
    # 盗A盗j盗・痿〇貼側'・痿囁ス貼転邸・貼脱"他
    if @battler.is_a?(Game_Actor) or @battler.is_a?(Game_Enemy)
      @battler.animation_duration = @_animation_duration
    end
    super(*arg)
  end
  
  def x=(x)
    x += @effect_ox
    super(x)
  end
  
  def y=(y)
    y += @effect_oy
    super(y)
  end
    
  #--------------------------------------------------------------------------
  # ・・ 盗G盗t盗F盗N盗g痿囃)痿囃E痿囃H窓・痿ゞ・n痿囃,窓X綜V
  #--------------------------------------------------------------------------
  def update_effect
    # 邸p"x痿囃,総C綜続
    if USE_TURNING 
      if @_upside_down
        self.angle = (@_turning + 180) % 360
      else
        self.angle = @_turning
      end
    end
    # X 窓・痿ゞ痿囃,総C綜続'l
    @effect_ox = 0
    @effect_ox += @_shake     if USE_SHAKE
    @effect_ox += @_moving[0] if USE_MOVING
    # Y 窓・痿ゞ痿囃,総C綜続'l
    @effect_oy = 0
    @effect_oy -= @fly        if USE_FLY
    @effect_oy += @_moving[1] if USE_MOVING
    if  @_animation == nil or @_animation == []
      self.effect_clear
    end
  end
  #--------------------------------------------------------------------------
  # ・・ 盗G盗t盗F盗N盗g総痿暗炭痿安実# 痿・・€囁ュ痿囃H痿囃,痿囁ィ痿湯*"|痿囃(痿囃,痿囃%痿囃&痿囃G痿・痿囁、痿囁カ痿囃<痿囃&痿囃?痿囃$痿囁ヲ痿囁ォ
  #--------------------------------------------------------------------------
  def effect_clear
    @_effect_ox = 0
    @_effect_oy = 0
    @_shake_power = 0
    @_shake_speed = 0
    @_shake_duration = 0
    @_shake_direction = 1
    @_shake = 0
    @_upside_down = false
    @_reverse = false
    @_turning_direction = 1
    @_turning_speed = 0
    @_turning_duration = 0
    @_turning = 0
    @_move_quick_return = true
    @_move_speed = 0
    @_move_coordinates = [0,0,0,0]
    @_move_jump = false
    @_move_duration = 0
    @_moving = [0,0]
    @_add_anime_id = 0
  end
  #--------------------------------------------------------------------------
  # ・・ 盗V盗F盗C盗N
  #--------------------------------------------------------------------------
  module SHAKE
    #--------------------------------------------------------------------------
    # ・・ 盗I盗u盗W盗F盗N盗g総痿暗炭痿安鹿
    #--------------------------------------------------------------------------
    def initialize(*arg)
      @_shake_power = 0
      @_shake_speed = 0
      @_shake_duration = 0
      @_shake_direction = 1
      @_shake = 0
      super(*arg)
    end
    #--------------------------------------------------------------------------
    # ・・ 盗V盗F盗C盗N痿囃,邸J貼n
    #     power    : 痿溝№€囁ア
    #     speed    : '測痿囁ア
    #     duration : 貼転邸・
    #--------------------------------------------------------------------------
    def start_shake(power, speed, duration)
      @_shake_power = power
      @_shake_speed = speed
      @_shake_duration = duration
    end
    def animation_process_timing(*arg)
      bool = false
      timing = arg[0]
      hit    = arg[1]
      color  = timing.flash_color 
      if (timing.condition == 0) or
         (timing.condition == 1 and hit == true) or
         (timing.condition == 2 and hit == false)
        if timing.se.name =~ SHAKE_FILE
          bool = true
          power    = color.red
          speed    = color.blue
          duration = color.green
          # 盗V盗F盗C盗N痿囃O邸J貼n
          self.start_shake(power, speed, duration)
        end
      end
      super(*arg) if bool == false
    end
    #--------------------------------------------------------------------------
    # ・・ 盗V盗F盗C盗N窓X綜V
    #--------------------------------------------------------------------------
    def update_shake
      if @_shake_duration >= 1 or @_shake != 0
        delta = (@_shake_power * @_shake_speed * @_shake_direction) / 10.0
        if @_shake_duration <= 1 and @_shake * (@_shake + delta) < 0
          @_shake = 0
        else
          @_shake += delta
        end
        if @_shake > @_shake_power * 2
          @_shake_direction = -1
        end
        if @_shake < - @_shake_power * 2
          @_shake_direction = 1
        end
        if @_shake_duration >= 1
          @_shake_duration -= 1
        end
      end
    end
    def update(*arg)
      # 盗V盗F盗C盗N
      if !@battler.nil? and @battler.shake
        self.start_shake(DAMAGE_SHAKE_POWER,DAMAGE_SHAKE_SPEED,DAMAGE_SHAKE_DURATION)
        @battler.shake = false
      end
      update_shake
      super(*arg)
    end
  end
  #--------------------------------------------------------------------------
  # ・・ 痿庵可]・E総達痿安・遜"]
  #--------------------------------------------------------------------------
  module TURNING
    #--------------------------------------------------------------------------
    # ・・ 盗I盗u盗W盗F盗N盗g総痿暗炭痿安鹿
    #--------------------------------------------------------------------------
    def initialize(*arg)
      @_upside_down = false
      @_turning_direction = 1
      @_turning_speed = 0
      @_turning_duration = 0
      @_turning = 0
      super(*arg)
    end
    #--------------------------------------------------------------------------
    # ・・ 総達痿安・遜"]痿囃O邸J貼n
    #--------------------------------------------------------------------------
    def start_upside_down
      @_upside_down = @_upside_down ? false : true
    end
    #--------------------------------------------------------------------------
    # ・・ 痿庵可]痿囃O邸J貼n
    #     direction: 痿・仕鋳[
    #     speed    : '測痿囁ア
    #     duration : 貼転邸・
    #--------------------------------------------------------------------------
    def start_turning(direction, speed, duration)
      @_turning_direction = direction
      @_turning_speed = speed
      @_turning_duration = duration
      @_turning = @_turning_direction == 1 ? 0 : 360
    end
    def animation_process_timing(*arg)
      bool = false
      timing = arg[0]
      hit    = arg[1]
      color  = timing.flash_color 
      if (timing.condition == 0) or
         (timing.condition == 1 and hit == true) or
         (timing.condition == 2 and hit == false)
        if timing.se.name =~ UPSIDE_DOWN_FILE
          bool = true
          # 総達痿安・遜"]痿囃O邸J貼n
          self.start_upside_down
        end
        if timing.se.name =~ TURNING_FILE
          bool = true
          direction = color.red == 0 ? 1 : -1
          speed     = color.blue
          duration  = color.green
          # 痿庵可]痿囃O邸J貼n
          self.start_turning(direction, speed, duration)
        end
      end
      super(*arg) if bool == false
    end
    def update(*arg)
      # 痿庵可]
      update_turning
      super(*arg)
    end
    #--------------------------------------------------------------------------
    # ・・ 痿庵可]窓X綜V
    #--------------------------------------------------------------------------
    def update_turning
      if @_turning_duration > 0 or @_turning != 0
        @_turning += @_turning_direction * @_turning_speed / 2.0
        # 貼c痿囃G痿庵可]綜"痿囃O・存痿囃F痿囁オ
        if @_turning_direction == -1
          if @_turning_duration > 0 and @_turning < 0
            @_turning_duration -= 1
          end
        elsif @_turning_direction == 1
          if @_turning_duration > 0 and @_turning >= 360
            @_turning_duration -= 1
          end
        end
        # ・・痿安財€・・髄ア
        while @_turning < 0
          @_turning += 360
        end
        if @_turning_duration <= 0
          @_turning = 0
        end
        @_turning %= 360
      end
    end
  end
  #--------------------------------------------------------------------------
  # ・・ 窓其痿・"遜"]
  #--------------------------------------------------------------------------
  module REVERSE
    #--------------------------------------------------------------------------
    # ・・ 盗I盗u盗W盗F盗N盗g総痿暗炭痿安鹿
    #--------------------------------------------------------------------------
    def initialize(*arg)
      @_reverse = false
      super(*arg)
    end
    #--------------------------------------------------------------------------
    # ・・ 窓其痿・"遜"]痿囃O邸J貼n
    #--------------------------------------------------------------------------
    def start_reverse
      @_reverse = @_reverse ? false : true
    end
    def animation_process_timing(*arg)
      bool = false
      timing = arg[0]
      hit    = arg[1]
      if (timing.condition == 0) or
         (timing.condition == 1 and hit == true) or
         (timing.condition == 2 and hit == false)
        if timing.se.name == REVERSE_FILE
          bool = true
          # 窓其痿・"遜"]痿囃O邸J貼n
          self.start_reverse
        end
      end
      super(*arg) if bool == false
    end
    #--------------------------------------------------------------------------
    # ・・ 窓其痿・"遜"]窓X綜V
    #--------------------------------------------------------------------------
    def update_reverse
      if !@battler.nil?  
        reverse = (@_reverse or @battler.reverse)
      else
        reverse = @_reverse
      end
      if @last_reverse != reverse
        self.mirror = reverse
        @last_reverse = reverse
      end
    end
    def update(*arg)
      # "遜"]
      update_reverse
      super(*arg)
    end
  end
  #--------------------------------------------------------------------------
  # ・・ ・・"速
  #--------------------------------------------------------------------------
  module MOVING
    #--------------------------------------------------------------------------
    # ・・ 盗I盗u盗W盗F盗N盗g総痿暗炭痿安鹿
    #--------------------------------------------------------------------------
    def initialize(*arg)
      @_move_quick_return = true
      @_move_speed = 0
      @_move_coordinates = [0,0,0,0]
      @_move_jump = false
      @_move_duration = 0
      @_moving = [0,0]
      super(*arg)
    end
    #--------------------------------------------------------------------------
    # ・・ ・・"速痿囃O邸J貼n
    #     x            : X 窓・痿ゞ
    #     y            : Y 窓・痿ゞ
    #     speed        : '測痿囁ア
    #     quick_return : 痿湯?痿囃H痿囁ァ痿囃'痿囁「痿囁ァ
    #--------------------------------------------------------------------------
    def start_moving(x, y, speed, quick_return)
      @_move_quick_return = quick_return == 0 ? false : true
      @_move_speed = speed
      @_move_coordinates = [x,y,@_move_coordinates[0],@_move_coordinates[1]]
      distance = (@_move_coordinates[2] - @_move_coordinates[0]).abs +
                 (@_move_coordinates[3] - @_move_coordinates[1]).abs
      @_move_duration = distance
    end
    def animation_process_timing(*arg)
      bool = false
      timing = arg[0]
      hit    = arg[1]
      if (timing.condition == 0) or
         (timing.condition == 1 and hit == true) or
         (timing.condition == 2 and hit == false)
        if timing.se.name =~ MOVE_FILE
          bool = true
          x           = (color.red-128)  * 10
          y           = (color.blue-128) * 10
          speed       = color.green
          quick_return= color.alpha
          # ・・"速痿囃O邸J貼n
          self.start_moving(x, y, speed, quick_return)
        end
      end
      super(*arg) if bool == false
    end
    #--------------------------------------------------------------------------
    # ・・ ・・"速窓X綜V
    #--------------------------------------------------------------------------
    def update_moving
      @move_distance = (@_move_coordinates[2] - @_move_coordinates[0]).abs +
                       (@_move_coordinates[3] - @_move_coordinates[1]).abs
      if @move_distance > 0
        return if @_moving[0] == @_move_coordinates[0] and @_moving[1] == @_move_coordinates[1]
        array = @_move_coordinates
        x = (array[2] + 1.0 * (array[0] - array[2]) * (@move_distance - @_move_duration) / @move_distance.to_f).to_i
        y = (array[3] + 1.0 * (array[1] - array[3]) * (@move_distance - @_move_duration) / @move_distance.to_f).to_i
        @_moving = [x, y]
        if @_move_quick_return and @_move_duration == 0
          @_move_coordinates = [0,0,array[0],array[1]]
          @_move_duration = @move_distance
        end
        @_move_duration -= @_move_speed
        @_move_duration = [@_move_duration, 0].max
      end
    end
    def update(*arg)
      # ・・"速
      update_moving
      super(*arg)
    end
  end
  #--------------------------------------------------------------------------
  # ・・ '・痿庵%植盗j盗・
  #--------------------------------------------------------------------------
  module ADD_ANIME
    #--------------------------------------------------------------------------
    # ・・ 盗I盗u盗W盗F盗N盗g総痿暗炭痿安鹿
    #--------------------------------------------------------------------------
    def initialize(*arg)
      @_add_anime_id = 0
      super(*arg)
    end
    #--------------------------------------------------------------------------
    # ・・ 盗A盗j盗・'・痿庵≪~囃O邸J貼n
    #     id           : ID
    #     hit          : 痿淘サ'痿盗t盗痿案鍛盗O
    #--------------------------------------------------------------------------
    def start_add_anime(id)
      @_add_anime_id = id
    end
    def animation_process_timing(*arg)
      bool = false
      timing = arg[0]
      hit    = arg[1]
      if (timing.condition == 0) or
         (timing.condition == 1 and hit == true) or
         (timing.condition == 2 and hit == false)
        if timing.se.name =~ ADD_ANIME_FILE
          bool = true
          id = color.red + color.blue + color.green
          # 盗A盗j盗・'・痿庵≪~囃O邸J貼n
          self.start_add_anime(id)
        end
      end
      super(*arg) if bool == false
    end
    #--------------------------------------------------------------------------
    # ・・ '・痿庵%植盗j盗・窓X綜V
    #--------------------------------------------------------------------------
    def update_add_anime
      # 盗A盗j盗・・[盗V盗痿‘・
      if @_add_anime_id != 0
        animation = $data_animations[@_add_anime_id]
        animation(animation, true)
        @_add_anime_id = 0
      end
    end
    def update(*arg)
      update_add_anime if !@battler.nil?
      super(*arg)
    end
  end
  #--------------------------------------------------------------------------
  # ・・ 貼c'・
  #--------------------------------------------------------------------------
  module SHADOW
    #--------------------------------------------------------------------------
    # ・・ 盗I盗u盗W盗F盗N盗g総痿暗炭痿安鹿
    #--------------------------------------------------------------------------
    def initialize(*arg)
      @shadow = []
      super(*arg)
    end
    #--------------------------------------------------------------------------
    # ・・ 貼c'・窓X綜V
    #--------------------------------------------------------------------------
    def update_shadow
      # 貼c'・
      if @battler.shadow
        if Graphics.frame_count % 2 == 0
          shadow = ::Sprite.new(self.viewport)
          shadow.bitmap = self.bitmap
          shadow.x = self.x
          shadow.y = self.y
          shadow.z = self.z
          shadow.ox = self.ox
          shadow.oy = self.oy
          shadow.mirror = self.mirror
          shadow.angle = self.angle
          shadow.opacity = 160
          shadow.zoom_x = self.zoom_x
          shadow.zoom_y = self.zoom_y
          @shadow.push([shadow,duration = 10,@battler.true_x + @effect_ox,@battler.true_y + @effect_oy])
        end
      end
      for s in @shadow
        if !s[0].disposed?
          s[0].update
          s[1] -= 1
          if s[1] < 1
            s[0].dispose
          else
            s[0].x = @battler.screen_x(s[2])
            s[0].y = @battler.screen_y(s[3])
          end
        else
          s = nil
        end
      end
      @shadow.compact!
    end
    def update(*arg)
      super(*arg)
      update_shadow if !@battler.nil?
    end
  end
  #--------------------------------------------------------------------------
  # ・・ "嘆窓s
  #--------------------------------------------------------------------------
  module FLY
    #--------------------------------------------------------------------------
    # ・・ 盗I盗u盗W盗F盗N盗g総痿暗炭痿安鹿
    #--------------------------------------------------------------------------
    def initialize(*arg)
      @fly = 0
      @fly_direction = 1
      super(*arg)
    end
    #--------------------------------------------------------------------------
    # ・・ "嘆窓s窓X綜V
    #--------------------------------------------------------------------------
    def update_fly
      if @rand > 0
        @rand -= 1
        return
      end
      if @battler.fly != 0
        if @fly < @battler.fly / 4
          @fly_direction = 1
        elsif @fly > @battler.fly / 2
          @fly_direction = -1
        end
        @fly += 0.2 * @fly_direction
      end
    end
    def update(*arg)
      update_fly if !@battler.nil?
      super(*arg)
    end
  end
  #--------------------------------------------------------------------------
  # ・・ Game_Battler痿廃
  #--------------------------------------------------------------------------
  module Game_Battler
    #--------------------------------------------------------------------------
    # ・・ "嘆窓s総坦'・痿囃&痿囁ウ痿囃$・袖痿囁「盗X盗e・[盗^盗X痿淘コ・i"z痿白P・j
    #--------------------------------------------------------------------------
    FLY_STATES = [""嘆窓s"]
    #--------------------------------------------------------------------------
    # ・・ "嘆窓s痿囃,窓痿壯~囁ア・@盗f盗t盗H盗痿稿暖'l
    #--------------------------------------------------------------------------
    FLY_HEIGHT = 60
    #--------------------------------------------------------------------------
    # ・・ ・旦邸J盗C盗"盗X盗^盗"盗X痿・書・
    #--------------------------------------------------------------------------
    class << self
      attr_accessor :shake                   # 盗V盗F盗C盗N邸J貼n盗t盗痿案鍛盗O
      attr_accessor :reverse                 # 窓其痿・"遜"]盗t盗痿案鍛盗O
      attr_accessor :shadow                  # 貼c'・盗t盗痿案鍛盗O
      attr_writer   :fly                     # "嘆窓s痿囃,窓痿壯~囁ア
    end
    #--------------------------------------------------------------------------
    # ・・ "嘆窓s
    #--------------------------------------------------------------------------
    def fly
      if @fly != nil
        return @fly
      end
      if (@states & FLY_STATES) != []
        return FLY_HEIGHT
      end
      return 0
    end
  end
  #--------------------------------------------------------------------------
  # ・・ include
  #--------------------------------------------------------------------------
  include SHAKE       if USE_SHAKE
  include TURNING     if USE_TURNING
  include REVERSE     if USE_REVERSE
  include MOVING      if USE_MOVING
  include ADD_ANIME   if USE_ADD_ANIME
  include SHADOW      if USE_SHADOW
  include FLY         if USE_FLY 
end


class Sprite_Battler < RPG::Sprite
  include ANIMATION_PLUS
end

class Game_Actor < Game_Battler
  include ANIMATION_PLUS::Game_Battler
end

class Game_Enemy < Game_Battler
  include ANIMATION_PLUS::Game_Battler
end

Deixe um comentário

  • Seja social e nos siga!

           
  • Páginas

  • Tags Especiais

  • Categorias

  • Parceiros

  • eXTReMe Tracker
    Copyright © 2001 - 2017 Gaming Room. Todos os Direitos Reservados - É expressamente proibida a reprodução total ou parcial deste site sem o consentimento dos autores.