Class: BattleUI::ExpDistribution::PokemonInfo

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

Overview

UI element showing the basic information

Constant Summary collapse

EXP_BAR_INFO =

The information of the Exp Bar

[79, 2, 0, 0, 1]
COORDINATES =

Coordinate where the UI element is supposed to show

[[17, 10], [162, 20], [17, 50], [162, 60], [17, 90], [162, 100]]

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

Constructor Details

#initialize(viewport, index, pokemon, exp_received) ⇒ PokemonInfo

Create a new Pokemon Info

Parameters:



125
126
127
128
129
130
131
132
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00500 ExpDistribution.rb', line 125

def initialize(viewport, index, pokemon, exp_received)
  super(viewport, *COORDINATES[index])
  @exp_received = exp_received
  @leveling_up = false
  create_sprites
  create_animation
  self.data = pokemon
end

Instance Attribute Details

#leveling_upBoolean

Tell if the pokemon is leveling up or not

Returns:

  • (Boolean)


117
118
119
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00500 ExpDistribution.rb', line 117

def leveling_up
  @leveling_up
end

Instance Method Details

#data=(pokemon)

Set the data shown by the UI element

Parameters:



142
143
144
145
146
147
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00500 ExpDistribution.rb', line 142

def data=(pokemon)
  @pokemon = pokemon
  super(pokemon)
  @gender.x = @x + 42 + @name.real_width
  @level_up_arrow.visible = leveling_up
end

#update

Update the animation



135
136
137
138
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00500 ExpDistribution.rb', line 135

def update
  @animation.update
  @exp_bar.data = @pokemon
end