Sha256: 1970897fea36c2d20606cb5fd362fedd6c9524c10287e193cf0afca3683dce29

Contents?: true

Size: 374 Bytes

Versions: 3

Compression:

Stored size: 374 Bytes

Contents

require "vector2d"

class Coordinates < Vector2d
  def self.zero
    Coordinates.new(0, 0)
  end

  def self.up
    Coordinates.new(0, -1)
  end

  def self.down
    Coordinates.new(0, 1)
  end

  def self.left
    Coordinates.new(-1, 0)
  end

  def self.right
    Coordinates.new(1, 0)
  end

  def x=(value)
    @x = value
  end

  def y=(value)
    @y = value
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fantasy-0.1.3 lib/fantasy/coordinates.rb
fantasy-0.1.1 lib/fantasy/coordinates.rb
fantasy-0.1.0 lib/fantasy/coordinates.rb