Class: UI::PokemonIconSprite
- Inherits:
-
SpriteSheet
- Object
- LiteRGSS::Disposable
- LiteRGSS::Drawable
- LiteRGSS::Sprite
- LiteRGSS::ShaderedSprite
- Sprite
- ShaderedSprite
- SpriteSheet
- UI::PokemonIconSprite
- Defined in:
- scripts/01450 Systems/00000 General/00100 UI Generics/00500 HelperSprites.rb
Overview
Class that show the icon sprite of a Pokemon
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from SpriteSheet
Attributes inherited from LiteRGSS::ShaderedSprite
Attributes inherited from LiteRGSS::Sprite
#__index__, #angle, #bitmap, #height, #mirror, #opacity, #ox, #oy, #src_rect, #viewport, #visible, #width, #x, #y, #z, #zoom, #zoom_x, #zoom_y
Instance Method Summary collapse
-
#data=(pokemon)
Set the pokemon.
-
#initialize(viewport, auto_align = true) ⇒ PokemonIconSprite
constructor
Create a new Pokemon FaceSprite.
-
#update
Update the pokemon animation.
Methods inherited from SpriteSheet
Methods inherited from Sprite
#load, #mouse_in?, #set_origin_div, #set_rect, #set_rect_div, #set_z, #simple_mouse_in?, #translate_mouse_coords
Methods inherited from LiteRGSS::Sprite
new, #set_origin, #set_position
Methods inherited from LiteRGSS::Disposable
Constructor Details
#initialize(viewport, auto_align = true) ⇒ PokemonIconSprite
Create a new Pokemon FaceSprite
237 238 239 240 241 242 |
# File 'scripts/01450 Systems/00000 General/00100 UI Generics/00500 HelperSprites.rb', line 237 def initialize(, auto_align = true) super(, 2, 1) @auto_align = auto_align @max_counter = 60 @counter = 0 end |
Instance Method Details
#data=(pokemon)
Set the pokemon
246 247 248 249 250 251 252 253 254 255 |
# File 'scripts/01450 Systems/00000 General/00100 UI Generics/00500 HelperSprites.rb', line 246 def data=(pokemon) if (self.visible = (pokemon ? true : false)) bmp = pokemon.icon @nb_x = (bmp.width / bmp.height).clamp(1, Float::INFINITY) self.bitmap = bmp auto_align(bmp) if @auto_align @counter = 0 @max_counter = max_counter(pokemon) end end |
#update
Update the pokemon animation
258 259 260 261 262 263 264 |
# File 'scripts/01450 Systems/00000 General/00100 UI Generics/00500 HelperSprites.rb', line 258 def update @counter += 1 if @counter >= @max_counter self.sx = (@sx + 1) % 2 @counter = 0 end end |