Class: UI::ThrowingBallSprite
- Inherits:
-
SpriteSheet
- Object
- LiteRGSS::Disposable
- LiteRGSS::Drawable
- LiteRGSS::Sprite
- LiteRGSS::ShaderedSprite
- Sprite
- ShaderedSprite
- SpriteSheet
- UI::ThrowingBallSprite
- Defined in:
- scripts/01450 Systems/00000 General/00100 UI Generics/00700 ThrowingBallSprite.rb
Overview
Sprite responsive of showing the sprite of the Ball we throw to Pokemon or to release Pokemon
Constant Summary collapse
- MOVE_PROGRESSION_CELL =
Array mapping the move progression to the right cell
[17, 16, 15, 16, 17, 18, 19, 18, 17]
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
-
#ball_offset_y ⇒ Integer
Get the ball offset y in order to make it the same position as the Pokemon sprite.
-
#break_progression=(progression)
Function that adjust the sy depending on the progression of the “break” animation.
-
#caught_progression=(progression)
Function that adjust the sy depending on the progression of the “caught” animation.
-
#close_progression=(progression)
Function that adjust the sy depending on the progression of the “close” animation.
-
#initialize(viewport, pokemon_or_item) ⇒ ThrowingBallSprite
constructor
Create a new ThrowingBallSprite.
-
#move_progression=(progression)
Function that adjust the sy depending on the progression of the “move” animation.
-
#open_progression=(progression)
Function that adjust the sy depending on the progression of the “open” animation.
-
#throw_progression=(progression)
Function that adjust the sy depending on the progression of the “throw” animation.
-
#trainer_offset_y ⇒ Integer
Get the ball offset y in order to make it look like being in trainer's hand.
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, #update
Methods inherited from LiteRGSS::Sprite
new, #set_origin, #set_position
Methods inherited from LiteRGSS::Disposable
Constructor Details
#initialize(viewport, pokemon_or_item) ⇒ ThrowingBallSprite
Create a new ThrowingBallSprite
9 10 11 12 13 |
# File 'scripts/01450 Systems/00000 General/00100 UI Generics/00700 ThrowingBallSprite.rb', line 9 def initialize(, pokemon_or_item) super(, 1, 32) resolve_image(pokemon_or_item) self.sy = 3 end |
Instance Method Details
#ball_offset_y ⇒ Integer
Get the ball offset y in order to make it the same position as the Pokemon sprite
63 64 65 |
# File 'scripts/01450 Systems/00000 General/00100 UI Generics/00700 ThrowingBallSprite.rb', line 63 def ball_offset_y return 8 end |
#break_progression=(progression)
Function that adjust the sy depending on the progression of the “break” animation
46 47 48 |
# File 'scripts/01450 Systems/00000 General/00100 UI Generics/00700 ThrowingBallSprite.rb', line 46 def break_progression=(progression) self.sy = (progression * 7).floor.clamp(0, 6) + 20 end |
#caught_progression=(progression)
Function that adjust the sy depending on the progression of the “caught” animation
52 53 54 55 56 57 58 59 |
# File 'scripts/01450 Systems/00000 General/00100 UI Generics/00700 ThrowingBallSprite.rb', line 52 def caught_progression=(progression) target = (progression * 5).floor if target == 5 self.sy = 17 else self.sy = 27 + target end end |
#close_progression=(progression)
Function that adjust the sy depending on the progression of the “close” animation
29 30 31 32 33 34 35 36 |
# File 'scripts/01450 Systems/00000 General/00100 UI Generics/00700 ThrowingBallSprite.rb', line 29 def close_progression=(progression) target = (progression * 9).floor if target == 9 self.sy = 3 else self.sy = target + 6 end end |
#move_progression=(progression)
Function that adjust the sy depending on the progression of the “move” animation
40 41 42 |
# File 'scripts/01450 Systems/00000 General/00100 UI Generics/00700 ThrowingBallSprite.rb', line 40 def move_progression=(progression) self.sy = MOVE_PROGRESSION_CELL[(progression * 8).floor] end |
#open_progression=(progression)
Function that adjust the sy depending on the progression of the “open” animation
23 24 25 |
# File 'scripts/01450 Systems/00000 General/00100 UI Generics/00700 ThrowingBallSprite.rb', line 23 def open_progression=(progression) self.sy = (progression * 2).floor.clamp(0, 1) + 4 end |
#throw_progression=(progression)
Function that adjust the sy depending on the progression of the “throw” animation
17 18 19 |
# File 'scripts/01450 Systems/00000 General/00100 UI Generics/00700 ThrowingBallSprite.rb', line 17 def throw_progression=(progression) self.sy = (progression * 4).floor.clamp(0, 3) end |
#trainer_offset_y ⇒ Integer
Get the ball offset y in order to make it look like being in trainer's hand
69 70 71 |
# File 'scripts/01450 Systems/00000 General/00100 UI Generics/00700 ThrowingBallSprite.rb', line 69 def trainer_offset_y return 40 end |