Class: Launch::Frame

Inherits:
BaseFrame show all
Defined in:
lib/launch.rb

Constant Summary collapse

DUDHEIGHT =
2

Instance Attribute Summary

Attributes inherited from BaseFrame

#last_frame, #position, #speed, #time_to_explosion

Instance Method Summary collapse

Constructor Details

#initialize(previous) ⇒ Frame

Returns a new instance of Frame.



34
35
36
37
38
39
40
# File 'lib/launch.rb', line 34

def initialize previous
  @last_frame = previous
  calc_speed
  calc_position
  @time_to_explosion = @last_frame.time_to_explosion - 1
  try_bang
end

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/launch.rb', line 42

def alive?
  !time_to_explosion.zero?
end