Class: BattleUI::TrainerPartyBalls::BallSprite

Inherits:
Sprite show all
Defined in:
scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00102 TrainerPartyBalls.rb

Overview

Class showing a ball in the TrainerPartyBalls UI

Instance Attribute Summary

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 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, index) ⇒ BallSprite

Create a new ball

Parameters:



118
119
120
121
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00102 TrainerPartyBalls.rb', line 118

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

Instance Method Details

#data=(party)

Update the data

Parameters:



125
126
127
128
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00102 TrainerPartyBalls.rb', line 125

def data=(party)
  pokemon = party[@index]
  set_bitmap(image_filename(pokemon), :interface)
end

#image_filename(pokemon)

Get the filename of the image to show as ball sprite

Parameters:



132
133
134
135
136
137
138
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00102 TrainerPartyBalls.rb', line 132

def image_filename(pokemon)
  return 'battle/ball_null' unless pokemon
  return 'battle/ball_dead' if pokemon.dead?
  return 'battle/ball_sick' if pokemon.status != 0

  return 'battle/ball_normal'
end