Class: UI::HoldSprite
- Inherits:
-
Sprite
- Object
- LiteRGSS::Disposable
- LiteRGSS::Drawable
- LiteRGSS::Sprite
- LiteRGSS::ShaderedSprite
- Sprite
- UI::HoldSprite
- Defined in:
- scripts/01450 Systems/00000 General/00100 UI Generics/00500 HelperSprites.rb
Overview
Sprite that show the hold item if the pokemon is holding an item
Constant Summary collapse
- IMAGE_NAME =
Name of the image in Graphics/Interface
'hold'
Instance Attribute Summary
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 used to show the hold image.
-
#initialize(viewport) ⇒ HoldSprite
constructor
Create a new Hold Sprite.
Methods inherited from Sprite
#load, #mouse_in?, #set_origin_div, #set_rect, #set_rect_div, #set_z, #simple_mouse_in?, #translate_mouse_coords, #update
Methods inherited from LiteRGSS::Sprite
new, #set_origin, #set_position
Methods inherited from LiteRGSS::Disposable
Constructor Details
#initialize(viewport) ⇒ HoldSprite
Create a new Hold Sprite
102 103 104 105 |
# File 'scripts/01450 Systems/00000 General/00100 UI Generics/00500 HelperSprites.rb', line 102 def initialize() super() set_bitmap(IMAGE_NAME, :interface) end |
Instance Method Details
#data=(pokemon)
Set the Pokemon used to show the hold image
109 110 111 112 113 114 115 116 117 |
# File 'scripts/01450 Systems/00000 General/00100 UI Generics/00500 HelperSprites.rb', line 109 def data=(pokemon) if pokemon item_id = ($game_temp.in_battle ? pokemon.battle_item : pokemon.item_holding) || 0 self.visible = item_id != 0 else self.visible = false end self.visible = (pokemon ? pokemon.item_holding != 0 : false) end |