Class: Asteroids::Missile

Inherits:
GameObject show all
Defined in:
lib/asteroids/missile/missile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from GameObject

#components, #draw, #mark_for_removal, #removable?, #update

Constructor Details

#initialize(ship, object_pool, x, y, vel_x, vel_y, angle) ⇒ Missile

Returns a new instance of Missile.



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/asteroids/missile/missile.rb', line 6

def initialize(ship, object_pool, x, y, vel_x, vel_y, angle)
  super(object_pool)
  @x = x
  @y = y
  @angle = angle
  @vel_x = vel_x
  @vel_y = vel_y
  @lifespan = 3
  @radius = 3
  @ship = ship
  @physics = MissilePhysics.new(self, object_pool)
  @graphics = MissileGraphics.new(self)
end

Instance Attribute Details

#angleObject

Returns the value of attribute angle.



4
5
6
# File 'lib/asteroids/missile/missile.rb', line 4

def angle
  @angle
end

#lifespanObject

Returns the value of attribute lifespan.



4
5
6
# File 'lib/asteroids/missile/missile.rb', line 4

def lifespan
  @lifespan
end

#radiusObject

Returns the value of attribute radius.



4
5
6
# File 'lib/asteroids/missile/missile.rb', line 4

def radius
  @radius
end

#shipObject

Returns the value of attribute ship.



4
5
6
# File 'lib/asteroids/missile/missile.rb', line 4

def ship
  @ship
end

#vel_xObject

Returns the value of attribute vel_x.



4
5
6
# File 'lib/asteroids/missile/missile.rb', line 4

def vel_x
  @vel_x
end

#vel_yObject

Returns the value of attribute vel_y.



4
5
6
# File 'lib/asteroids/missile/missile.rb', line 4

def vel_y
  @vel_y
end

#xObject

Returns the value of attribute x.



4
5
6
# File 'lib/asteroids/missile/missile.rb', line 4

def x
  @x
end

#yObject

Returns the value of attribute y.



4
5
6
# File 'lib/asteroids/missile/missile.rb', line 4

def y
  @y
end