Class: Nimo::Behavior::Velocity
- Defined in:
- lib/nimo/behavior/with_velocity.rb
Instance Attribute Summary collapse
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
Instance Attribute Details
#x ⇒ Object
Returns the value of attribute x
3 4 5 |
# File 'lib/nimo/behavior/with_velocity.rb', line 3 def x @x end |
#y ⇒ Object
Returns the value of attribute y
3 4 5 |
# File 'lib/nimo/behavior/with_velocity.rb', line 3 def y @y end |
Instance Method Details
#adjust(radian) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/nimo/behavior/with_velocity.rb', line 4 def adjust(radian) xl = Math::cos(radian)*self.x - Math::sin(radian)*self.y yl = Math::sin(radian)*self.x + Math::cos(radian)*self.y self.x = xl self.y = yl end |