Class: Bang::Frame
Instance Attribute Summary
Attributes inherited from BaseFrame
#last_frame, #particles, #speed, #time_to_live
Instance Method Summary collapse
- #alive? ⇒ Boolean
-
#initialize(last_frame) ⇒ Frame
constructor
A new instance of Frame.
Constructor Details
#initialize(last_frame) ⇒ Frame
Returns a new instance of Frame.
27 28 29 30 31 32 33 34 |
# File 'lib/bang.rb', line 27 def initialize last_frame @angle_increment = 360 / last_frame.particles.size @speed = last_frame.speed @time_to_live = last_frame.time_to_live - 1 @last_frame = last_frame @particles = calc_particles end |
Instance Method Details
#alive? ⇒ Boolean
36 37 38 |
# File 'lib/bang.rb', line 36 def alive? !time_to_live.zero? end |