Class: Asteroids::Asteroid
- Inherits:
-
GameObject
- Object
- GameObject
- Asteroids::Asteroid
- Defined in:
- lib/asteroids/asteroid/asteroid.rb
Instance Attribute Summary collapse
-
#angle ⇒ Object
Returns the value of attribute angle.
-
#radius ⇒ Object
Returns the value of attribute radius.
-
#vel_x ⇒ Object
Returns the value of attribute vel_x.
-
#vel_y ⇒ Object
Returns the value of attribute vel_y.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
- #explode ⇒ Object
-
#initialize(object_pool, x, y, vel_x, vel_y, angle, radius = 45) ⇒ Asteroid
constructor
A new instance of Asteroid.
Methods inherited from GameObject
#components, #draw, #mark_for_removal, #removable?, #update
Constructor Details
#initialize(object_pool, x, y, vel_x, vel_y, angle, radius = 45) ⇒ Asteroid
Returns a new instance of Asteroid.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/asteroids/asteroid/asteroid.rb', line 6 def initialize(object_pool, x, y, vel_x, vel_y, angle, radius = 45) super(object_pool) @x = x @y = y @angle = angle @vel_x = vel_x @vel_y = vel_y @physics = AsteroidPhysics.new(self, object_pool) @graphics = AsteroidGraphics.new(self) @radius = radius end |
Instance Attribute Details
#angle ⇒ Object
Returns the value of attribute angle.
4 5 6 |
# File 'lib/asteroids/asteroid/asteroid.rb', line 4 def angle @angle end |
#radius ⇒ Object
Returns the value of attribute radius.
4 5 6 |
# File 'lib/asteroids/asteroid/asteroid.rb', line 4 def radius @radius end |
#vel_x ⇒ Object
Returns the value of attribute vel_x.
4 5 6 |
# File 'lib/asteroids/asteroid/asteroid.rb', line 4 def vel_x @vel_x end |
#vel_y ⇒ Object
Returns the value of attribute vel_y.
4 5 6 |
# File 'lib/asteroids/asteroid/asteroid.rb', line 4 def vel_y @vel_y end |
#x ⇒ Object
Returns the value of attribute x.
4 5 6 |
# File 'lib/asteroids/asteroid/asteroid.rb', line 4 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
4 5 6 |
# File 'lib/asteroids/asteroid/asteroid.rb', line 4 def y @y end |