Class: Kame::Remocon::Opal::Turtle::Pos

Inherits:
Object
  • Object
show all
Defined in:
lib/kame/remocon/opal/turtle.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y) ⇒ Pos

Returns a new instance of Pos.



12
13
14
15
# File 'lib/kame/remocon/opal/turtle.rb', line 12

def initialize(x, y)
  @x = x
  @y = y
end

Instance Attribute Details

#xObject (readonly)

Returns the value of attribute x.



10
11
12
# File 'lib/kame/remocon/opal/turtle.rb', line 10

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



10
11
12
# File 'lib/kame/remocon/opal/turtle.rb', line 10

def y
  @y
end

Instance Method Details

#canvas_coordinateObject



22
23
24
# File 'lib/kame/remocon/opal/turtle.rb', line 22

def canvas_coordinate
  [@x + 200, @y + 200]
end

#move_to(x, y) ⇒ Object



17
18
19
20
# File 'lib/kame/remocon/opal/turtle.rb', line 17

def move_to(x, y)
  @x = x
  @y = y
end