Class: UI::Type1Sprite

Inherits:
SpriteSheet show all
Defined in:
scripts/01450 Systems/00000 General/00100 UI Generics/00500 HelperSprites.rb

Overview

Sprite that show the 1st type of the Pokemon

Direct Known Subclasses

Type2Sprite, TypeSprite

Instance Attribute Summary

Attributes inherited from SpriteSheet

#nb_x, #nb_y, #sx, #sy

Attributes inherited from LiteRGSS::ShaderedSprite

#blendmode, #shader

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

Methods inherited from SpriteSheet

#bitmap=, #select

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

#dispose, #disposed?

Constructor Details

#initialize(viewport, from_pokedex = false) ⇒ Type1Sprite

Create a new Type Sprite

Parameters:

  • viewport (Viewport, nil)

    the viewport in which the sprite is stored

  • from_pokedex (Boolean) (defaults to: false)

    if the type is the Pokedex type (other source image)



7
8
9
10
11
12
13
14
15
# File 'scripts/01450 Systems/00000 General/00100 UI Generics/00500 HelperSprites.rb', line 7

def initialize(viewport, from_pokedex = false)
  super(viewport, 1, each_data_type.size)
  filename = "types_#{$options.language}"
  if from_pokedex
    set_bitmap(RPG::Cache.pokedex_exist?(filename) ? filename : 'types', :pokedex)
  else
    set_bitmap(RPG::Cache.interface_exist?(filename) ? filename : 'types', :interface)
  end
end

Instance Method Details

#data=(pokemon)

Set the Pokemon used to show the type

Parameters:



19
20
21
# File 'scripts/01450 Systems/00000 General/00100 UI Generics/00500 HelperSprites.rb', line 19

def data=(pokemon)
  self.sy = pokemon.send(*data_source) if (self.visible = (pokemon ? true : false))
end