Class: UI::Hall_of_Fame::Star_Animation
- Inherits:
-
SpriteSheet
- Object
- LiteRGSS::Disposable
- LiteRGSS::Drawable
- LiteRGSS::Sprite
- LiteRGSS::ShaderedSprite
- Sprite
- ShaderedSprite
- SpriteSheet
- UI::Hall_of_Fame::Star_Animation
- Defined in:
- scripts/01450 Systems/00300 Hall of fame/00002 UI/00003 Stars_Animation.rb
Overview
Class that define the Star Animation
Instance Attribute Summary collapse
-
#counter ⇒ Integer
The counter for the animation.
-
#finished ⇒ Boolean
Tell if the animation is finished or not.
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
-
#initialize(viewport, frame_count = 2, repeat: false) ⇒ Star_Animation
constructor
Initialize the SpriteSheet.
-
#update
Update the animation depending on the @frame_count.
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
Methods inherited from LiteRGSS::Sprite
new, #set_origin, #set_position
Methods inherited from LiteRGSS::Disposable
Constructor Details
#initialize(viewport, frame_count = 2, repeat: false) ⇒ Star_Animation
Initialize the SpriteSheet
15 16 17 18 19 20 21 22 23 24 25 |
# File 'scripts/01450 Systems/00300 Hall of fame/00002 UI/00003 Stars_Animation.rb', line 15 def initialize(, frame_count = 2, repeat: false) super(, 6, 1) set_bitmap('hall_of_fame/stars', :interface) set_position(x, y) self.opacity = 0 @frame_count = frame_count @repeat = repeat @finished = false @counter = 0 @reversing = false end |
Instance Attribute Details
#counter ⇒ Integer
The counter for the animation
7 8 9 |
# File 'scripts/01450 Systems/00300 Hall of fame/00002 UI/00003 Stars_Animation.rb', line 7 def counter @counter end |
#finished ⇒ Boolean
Tell if the animation is finished or not
10 11 12 |
# File 'scripts/01450 Systems/00300 Hall of fame/00002 UI/00003 Stars_Animation.rb', line 10 def finished @finished end |
Instance Method Details
#update
Update the animation depending on the @frame_count
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'scripts/01450 Systems/00300 Hall of fame/00002 UI/00003 Stars_Animation.rb', line 28 def update return if @finished if @counter == @frame_count @counter = 0 if @reversing == true self.sx -= 1 if self.sx == 0 self.opacity = 0 @reversing = false @finished = true if !@repeat end elsif @reversing == false self.opacity = 255 if self.sx == 0 self.sx += 1 @reversing = true if self.sx == 5 end end @counter += 1 end |