Sha256: e005c449f26a748c1209c09604f49cec7b7f9de40beedf0fad02a16cb6e12968

Contents?: true

Size: 421 Bytes

Versions: 3

Compression:

Stored size: 421 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

  def clone
    Coordinates.new(@x, @y)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fantasy-0.1.7 lib/fantasy/coordinates.rb
fantasy-0.1.5.1 lib/fantasy/coordinates.rb
fantasy-0.1.5 lib/fantasy/coordinates.rb