Class: UI::Hall_of_Fame::End_Stars_Animation

Inherits:
SpriteStack show all
Defined in:
scripts/01450 Systems/00300 Hall of fame/00002 UI/00024 End_Stars_Animation.rb

Overview

Class that define the End Stars animation stack

Constant Summary

Constants inherited from SpriteStack

SpriteStack::NO_INITIAL_IMAGE

Instance Attribute Summary

Attributes inherited from SpriteStack

#animated, #data, #moving, #stack, #viewport, #x, #y

Instance Method Summary collapse

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) ⇒ End_Stars_Animation

Initialize the SpriteStack

Parameters:



7
8
9
10
11
12
# File 'scripts/01450 Systems/00300 Hall of fame/00002 UI/00024 End_Stars_Animation.rb', line 7

def initialize(viewport)
  super(viewport)
  @stars = Array.new(20) { Star_Animation.new(viewport, 5, repeat: true) }
  @stars.each { |star| star.set_position(rand(320), rand(240)) }
  @counter = 0
end

Instance Method Details

#update

Update each star's animation



15
16
17
18
19
20
21
22
23
# File 'scripts/01450 Systems/00300 Hall of fame/00002 UI/00024 End_Stars_Animation.rb', line 15

def update
  @stars.each_with_index do |star, index|
    if star.sx == 0
      star.set_position(rand(320), rand(240))
    end
    star.update if (index * 10) <= @counter
  end
  @counter += 1
end