Class: UI::Hall_of_Fame::Pokemon_Stars_Animation
- Inherits:
-
SpriteStack
- Object
- SpriteStack
- UI::Hall_of_Fame::Pokemon_Stars_Animation
- Defined in:
- scripts/01450 Systems/00300 Hall of fame/00002 UI/00006 Pokemon_Stars_Animation.rb
Overview
Class that define the Pokemon Stars animation
Constant Summary collapse
- X_ARRAY =
[67, 16, 90, 40, 65, 30]
- Y_ARRAY =
[20, 32, 90, 54, 48, 90]
Constants inherited from SpriteStack
Instance Attribute Summary
Attributes inherited from SpriteStack
#animated, #data, #moving, #stack, #viewport, #x, #y
Instance Method Summary collapse
-
#initialize(viewport) ⇒ Pokemon_Stars_Animation
constructor
Initialize the SpriteStack.
-
#reset
Reset the star animation to replay it when needed.
-
#spritestack_coordinates ⇒ Array<Integer>
The SpriteStack initial coordinates.
-
#update
Update each star animation.
Methods inherited from SpriteStack
#[], #add_background, #add_line, #add_text, #anime, #anime_delta_set, #dispose, #each, #execute_anime, #move, #move_to, #opacity, #opacity=, #push, #push_sprite, #set_origin, #set_position, #simple_mouse_in?, #size, #stop_animation, #translate_mouse_coords, #update_animation, #update_position, #visible, #visible=, #with_cache, #with_font, #with_surface, #z, #z=
Constructor Details
#initialize(viewport) ⇒ Pokemon_Stars_Animation
Initialize the SpriteStack
9 10 11 12 13 |
# File 'scripts/01450 Systems/00300 Hall of fame/00002 UI/00006 Pokemon_Stars_Animation.rb', line 9 def initialize() super(, *spritestack_coordinates) @stars = Array.new(6) { |i| add_sprite(X_ARRAY[i], Y_ARRAY[i], NO_INITIAL_IMAGE, type: Star_Animation) } @anim_counter = 0 end |
Instance Method Details
#reset
Reset the star animation to replay it when needed
30 31 32 33 34 35 36 37 38 |
# File 'scripts/01450 Systems/00300 Hall of fame/00002 UI/00006 Pokemon_Stars_Animation.rb', line 30 def reset return if @anim_counter == 0 @anim_counter = 0 @stars.each do |star| #star.sx = 0 star.finished = false end end |
#spritestack_coordinates ⇒ Array<Integer>
The SpriteStack initial coordinates
17 18 19 |
# File 'scripts/01450 Systems/00300 Hall of fame/00002 UI/00006 Pokemon_Stars_Animation.rb', line 17 def spritestack_coordinates return 25, 125 end |
#update
Update each star animation
22 23 24 25 26 27 |
# File 'scripts/01450 Systems/00300 Hall of fame/00002 UI/00006 Pokemon_Stars_Animation.rb', line 22 def update @stars.each_with_index do |star, index| star.update if @anim_counter > (index * 10) end @anim_counter += 1 end |