Class: RTanque::Explosion

Inherits:
Object
  • Object
show all
Includes:
Movable
Defined in:
lib/rtanque/explosion.rb

Constant Summary collapse

LIFE_SPAN =

ticks

Configuration.explosion.life_span

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Movable

#arena, #arena=, #bound_to_arena, #heading, #heading=, #position=, #speed, #speed=, #update_position

Constructor Details

#initialize(position) ⇒ Explosion

Returns a new instance of Explosion


6
7
8
9
# File 'lib/rtanque/explosion.rb', line 6

def initialize(position)
  @position = position
  @ticks = 0
end

Instance Attribute Details

#positionObject (readonly)

Returns the value of attribute position


4
5
6
# File 'lib/rtanque/explosion.rb', line 4

def position
  @position
end

Instance Method Details

#dead?Boolean

Returns:

  • (Boolean)

19
20
21
# File 'lib/rtanque/explosion.rb', line 19

def dead?
  @ticks > LIFE_SPAN
end

#percent_deadObject


11
12
13
# File 'lib/rtanque/explosion.rb', line 11

def percent_dead
  @ticks / LIFE_SPAN.to_f
end

#tickObject


15
16
17
# File 'lib/rtanque/explosion.rb', line 15

def tick
  @ticks += 1
end