Class: Gamefic::Sdk::Diagram::Position

Inherits:
Object
  • Object
show all
Defined in:
lib/gamefic-sdk/diagram.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x = 0, y = 0) ⇒ Position

Returns a new instance of Position.



9
10
11
12
13
# File 'lib/gamefic-sdk/diagram.rb', line 9

def initialize x = 0, y = 0
  @x = x
  @y = y
  freeze
end

Instance Attribute Details

#xObject

Returns the value of attribute x.



7
8
9
# File 'lib/gamefic-sdk/diagram.rb', line 7

def x
  @x
end

#yObject

Returns the value of attribute y.



7
8
9
# File 'lib/gamefic-sdk/diagram.rb', line 7

def y
  @y
end

Instance Method Details

#move(x, y) ⇒ Object



15
16
17
# File 'lib/gamefic-sdk/diagram.rb', line 15

def move x, y
  Position.new(self.x + x, self.y + y)
end