Class: BattleUI::SkillChoice::MoveButton

Inherits:
UI::SpriteStack show all
Defined in:
scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00300 SkillChoice.rb

Overview

Button of a move

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 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, #update_animation, #update_position, #visible, #with_cache, #with_font, #with_surface, #z, #z=

Constructor Details

#initialize(viewport, index) ⇒ MoveButton

Create a new Move button

Parameters:



105
106
107
108
109
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00300 SkillChoice.rb', line 105

def initialize(viewport, index)
  super(viewport)
  @index = index
  create_sprites
end

Instance Attribute Details

#indexInteger (readonly)

Get the index

Returns:



100
101
102
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00300 SkillChoice.rb', line 100

def index
  @index
end

Instance Method Details

#data=(pokemon)

Set the data

Parameters:



113
114
115
116
117
118
119
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00300 SkillChoice.rb', line 113

def data=(pokemon)
  @data = move = pokemon.moveset[@index]
  if (self.visible = move)
    @background.sy = move.type
    @text.data = move
  end
end

#visible=(visible)

Make sure sprite is visible only if the data is right

Parameters:

  • visible (Boolean)


123
124
125
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00300 SkillChoice.rb', line 123

def visible=(visible)
  super(visible && @data)
end