Class: BattleUI::AbilityBar

Inherits:
UI::SpriteStack show all
Includes:
GoingInOut, MultiplePosition, UI
Defined in:
scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00104 AbilityBar.rb

Overview

Sprite of a Trainer in the battle

Direct Known Subclasses

ItemBar

Defined Under Namespace

Classes: Background

Constant Summary

Constants inherited from UI::SpriteStack

UI::SpriteStack::NO_INITIAL_IMAGE

Instance Attribute Summary collapse

Attributes inherited from UI::SpriteStack

#animated, #data, #moving, #stack, #viewport, #x, #y

Instance Method Summary collapse

Methods included from MultiplePosition

#enemy?

Methods included from GoingInOut

#go_in, #go_out, #in?, #out?

Methods inherited from UI::SpriteStack

#[], #add_background, #add_line, #add_text, #anime, #anime_delta_set, #dispose, #each, #execute_anime, #move, #move_to, #opacity, #opacity=, #push, #push_sprite, #set_origin, #set_position, #simple_mouse_in?, #size, #stop_animation, #translate_mouse_coords, #update_animation, #update_position, #visible, #visible=, #with_cache, #with_font, #with_surface, #z, #z=

Constructor Details

#initialize(viewport, scene, bank, position) ⇒ AbilityBar

Create a new Ability Bar

Parameters:



28
29
30
31
32
33
34
35
36
37
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00104 AbilityBar.rb', line 28

def initialize(viewport, scene, bank, position)
  super(viewport)
  @scene = scene
  @bank = bank
  @position = position
  @animation_handler = Yuki::Animation::Handler.new
  @no_go_out = false
  create_sprites
  set_position(*sprite_position)
end

Instance Attribute Details

#animation_handlerYuki::Animation::Handler{ Symbol => Yuki::Animation::TimedAnimation} (readonly)

Get the animation handler

Returns:

  • (Yuki::Animation::Handler{ Symbol => Yuki::Animation::TimedAnimation})


9
10
11
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00104 AbilityBar.rb', line 9

def animation_handler
  @animation_handler
end

#bankInteger (readonly)

Get the bank of the pokemon shown by the sprite

Returns:



15
16
17
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00104 AbilityBar.rb', line 15

def bank
  @bank
end

#no_go_outBoolean (readonly)

Get if the animation out should be not played automatically

Returns:

  • (Boolean)


21
22
23
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00104 AbilityBar.rb', line 21

def no_go_out
  @no_go_out
end

#positionInteger (readonly)

Get the position of the pokemon shown by the sprite

Returns:



12
13
14
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00104 AbilityBar.rb', line 12

def position
  @position
end

#sceneBattle::Scene (readonly)

Get the scene linked to this object

Returns:



18
19
20
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00104 AbilityBar.rb', line 18

def scene
  @scene
end

Instance Method Details

#done?Boolean

Tell if the animations are done

Returns:

  • (Boolean)


46
47
48
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00104 AbilityBar.rb', line 46

def done?
  return @animation_handler.done?
end

#go_in_ability(no_go_out = false)

Tell the ability to go into the scene

Parameters:

  • no_go_out (Boolean) (defaults to: false)

    Set if the animation out should be not played automatically



55
56
57
58
59
60
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00104 AbilityBar.rb', line 55

def go_in_ability(no_go_out = false)
  delta = go_in_out_delta
  animation_handler[:in_out] ||= go_in_animation(no_go_out)
  animation_handler[:in_out].start(delta)
  @__in_out = :in
end

#update

Update the animations



40
41
42
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00104 AbilityBar.rb', line 40

def update
  @animation_handler.update
end