Advertisement
marlosgama

Untitled

Jan 2nd, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.25 KB | None | 0 0
  1.   #--------------------------------------------------------------------------
  2.   # * Animação do ataque
  3.   #     suffix : sufixo
  4.   #--------------------------------------------------------------------------
  5.   def animate_attack(suffix)
  6.     return unless FileTest.exist?("Graphics/Characters/#{@character_name}#{suffix}.png")
  7.     @old_character_name = @character_name
  8.     @character_name = "#{character_name}#{suffix}"
  9.     @old_pattern = @pattern
  10.     @pattern = 0
  11.     @old_anime = @step_anime
  12.     @step_anime = true
  13.     @attack_delay = 20
  14.   end
  15.   #--------------------------------------------------------------------------
  16.   # * Atualização do gráfico da animação
  17.   #--------------------------------------------------------------------------
  18.   def update_graphic_animation
  19.     return unless @attack_delay > 0
  20.     @attack_delay -= 1
  21.     if @attack_delay >= 15
  22.       @pattern = 0
  23.     elsif @attack_delay < 15 and @attack_delay >= 10
  24.       @pattern = 1
  25.     elsif @attack_delay < 10 and @attack_delay >= 5
  26.       @pattern = 2
  27.     elsif @attack_delay < 5
  28.       @pattern = 3
  29.     end
  30.     if @attack_delay == 0
  31.       @character_name = @old_character_name
  32.       @pattern = @old_pattern
  33.       @step_anime = @old_anime
  34.       @suffix = ''
  35.     end
  36.   end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement