Method: Tank#initialize

Defined in:
lib/entities/tank.rb

#initialize(object_pool, input) ⇒ Tank

Returns a new instance of Tank.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/entities/tank.rb', line 7

def initialize(object_pool, input)
  x, y = object_pool.map.spawn_point
  super(object_pool, x, y)
  @input = input
  @input.control(self)
  @physics = TankPhysics.new(self, object_pool)
  @sounds = TankSounds.new(self, object_pool)
  @health = TankHealth.new(self, object_pool)
  @graphics = TankGraphics.new(self)
  @direction = rand(0..7) * 45
  @gun_angle = rand(0..360)
  reset_modifiers
end