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.



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

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

Instance Attribute Details

#xObject

Returns the value of attribute x.



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

def x
  @x
end

#yObject

Returns the value of attribute y.



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

def y
  @y
end

Instance Method Details

#move(x, y) ⇒ Object



17
18
19
# File 'lib/gamefic-sdk/diagram.rb', line 17

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