Class: Arcade::Velocity

Inherits:
Vector
  • Object
show all
Defined in:
lib/arcade/vector.rb

Constant Summary collapse

HORIZ_REFLECT =
Matrix[[-1,0]
VERT_REFLECT =
ZERO =

Instance Method Summary collapse

Instance Method Details

#reflect_horizontallyObject



7
8
9
# File 'lib/arcade/vector.rb', line 7

def reflect_horizontally
  Arcade::Velocity[*(HORIZ_REFLECT * self).to_a]
end

#reflect_verticallyObject



11
12
13
# File 'lib/arcade/vector.rb', line 11

def reflect_vertically
  Arcade::Velocity[*(VERT_REFLECT * self).to_a]
end

#zero?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/arcade/vector.rb', line 15

def zero?
  self.eql? ZERO
end