Class: BattleUI::TrainerSprite
- Inherits:
-
ShaderedSprite
- Object
- LiteRGSS::Disposable
- LiteRGSS::Drawable
- LiteRGSS::Sprite
- LiteRGSS::ShaderedSprite
- Sprite
- ShaderedSprite
- BattleUI::TrainerSprite
- Includes:
- GoingInOut, MultiplePosition
- Defined in:
- scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00103 TrainerSprite.rb
Overview
Sprite of a Trainer in the battle
Constant Summary collapse
- FADE_AWAY_PIXEL_COUNT =
Number of pixels the sprite has to move in other to fade away from the scene
160
- BACK_FRAME_COUNT =
Define the number of frames inside a back trainer
2
Instance Attribute Summary collapse
-
#animation_handler ⇒ Yuki::Animation::Handler{ Symbol => Yuki::Animation::TimedAnimation}
readonly
Get the animation handler.
-
#bank ⇒ Integer
readonly
Get the bank of the pokemon shown by the sprite.
-
#position ⇒ Integer
readonly
Get the position of the pokemon shown by the sprite.
-
#scene ⇒ Battle::Scene
readonly
Get the scene linked to this object.
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
-
#done? ⇒ Boolean
Tell if the sprite animations are done.
-
#initialize(viewport, scene, battler, bank, position, battle_info) ⇒ TrainerSprite
constructor
Create a new TrainerSprite.
-
#show_next_frame
Set the battler on its next frame.
-
#show_previous_frame
Set the battler on its previous frame.
-
#update
Update the sprite.
Methods included from MultiplePosition
Methods included from GoingInOut
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, scene, battler, bank, position, battle_info) ⇒ TrainerSprite
Create a new TrainerSprite
30 31 32 33 34 35 36 37 38 39 40 |
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00103 TrainerSprite.rb', line 30 def initialize(, scene, battler, bank, position, battle_info) super() @animation_handler = Yuki::Animation::Handler.new @scene = scene @bank = bank @position = position @battle_info = battle_info set_bitmap(battler, :battler) src_rect.height = bitmap.height / BACK_FRAME_COUNT if @bank == 0 reset_position end |
Instance Attribute Details
#animation_handler ⇒ Yuki::Animation::Handler{ Symbol => Yuki::Animation::TimedAnimation} (readonly)
Get the animation handler
10 11 12 |
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00103 TrainerSprite.rb', line 10 def animation_handler @animation_handler end |
#bank ⇒ Integer (readonly)
Get the bank of the pokemon shown by the sprite
16 17 18 |
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00103 TrainerSprite.rb', line 16 def bank @bank end |
#position ⇒ Integer (readonly)
Get the position of the pokemon shown by the sprite
13 14 15 |
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00103 TrainerSprite.rb', line 13 def position @position end |
#scene ⇒ Battle::Scene (readonly)
Get the scene linked to this object
19 20 21 |
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00103 TrainerSprite.rb', line 19 def scene @scene end |
Instance Method Details
#done? ⇒ Boolean
Tell if the sprite animations are done
49 50 51 |
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00103 TrainerSprite.rb', line 49 def done? return @animation_handler.done? end |
#show_next_frame
Frames are ordered on the vertical axis
Set the battler on its next frame
55 56 57 58 |
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00103 TrainerSprite.rb', line 55 def show_next_frame new_y = src_rect.y + src_rect.height src_rect.y = new_y if new_y < bitmap.height end |
#show_previous_frame
Frames are ordered on the vertical axis
Set the battler on its previous frame
62 63 64 65 |
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00103 TrainerSprite.rb', line 62 def show_previous_frame new_y = src_rect.y - src_rect.height src_rect.y = new_y if new_y >= 0 end |
#update
Update the sprite
43 44 45 |
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00103 TrainerSprite.rb', line 43 def update @animation_handler.update end |