Class: Launch::InitialFrame
Constant Summary collapse
- EXPLOSIONRANGE =
(20..30)
- YSPEEDMAX =
Math.sqrt(2 * (YMAX-PADDING) * GRAVITY)
- XSPEEDRANGE =
(0..3)
- YSPEEDRANGE =
(5..YSPEEDMAX)
- ZSPEEDRANGE =
(0.1..0.2)
Instance Attribute Summary
Attributes inherited from BaseFrame
#last_frame, #position, #speed, #time_to_explosion
Instance Method Summary collapse
- #alive? ⇒ Boolean
-
#initialize ⇒ InitialFrame
constructor
A new instance of InitialFrame.
Constructor Details
#initialize ⇒ InitialFrame
Returns a new instance of InitialFrame.
18 19 20 21 22 23 24 |
# File 'lib/launch.rb', line 18 def initialize start_x = (PADDING..XMAX-PADDING).any @position = {x: start_x, y: 0, z: 0} @speed = {x: XSPEEDRANGE.any, y: YSPEEDRANGE.any, z: ZSPEEDRANGE.any} @time_to_explosion = EXPLOSIONRANGE.any @last_frame = self end |
Instance Method Details
#alive? ⇒ Boolean
26 27 28 |
# File 'lib/launch.rb', line 26 def alive? true end |