Class: Battle::Visual::IdlePokemonAnimation

Inherits:
Object
  • Object
show all
Defined in:
scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00001 Animations/01000 IdlePokemonAnimation.rb

Constant Summary collapse

OFFSET_SPRITE =

Pixel offset for each index of the sprite

[0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0]
OFFSET_BAR =

Pixel offset for each index of the bar

[0, -1, -2, -3, -4, -5, -5, -4, -3, -2, -1, 0]

Instance Method Summary collapse

Constructor Details

#initialize(visual, pokemon, bar) ⇒ IdlePokemonAnimation

Create a new IdlePokemonAnimation

Parameters:



12
13
14
15
16
17
18
19
20
21
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00001 Animations/01000 IdlePokemonAnimation.rb', line 12

def initialize(visual, pokemon, bar)
  @visual = visual
  @pokemon = pokemon
  # @type [Array<Integer>]
  @pokemon_origin = pokemon.send(:sprite_position)
  @bar = bar
  # @type [Array<Integer>]
  @bar_origin = bar.send(:sprite_position)
  @animation = create_animation
end

Instance Method Details

#remove

Function that rmoves the idle animation from the visual



29
30
31
32
33
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00001 Animations/01000 IdlePokemonAnimation.rb', line 29

def remove
  @pokemon.y = @pokemon_origin.last if @pokemon.in?
  @bar.y = @bar_origin.last if @bar.in?
  @visual.parallel_animations.delete(self.class)
end

#update

Function that updates the idle animation



24
25
26
# File 'scripts/01600 Alpha 25 Battle Engine/00002 Battle_Visual/00001 Animations/01000 IdlePokemonAnimation.rb', line 24

def update
  @animation.update
end