Class: Kame::Remocon::Opal::Turtle::Pos
- Inherits:
-
Object
- Object
- Kame::Remocon::Opal::Turtle::Pos
- Defined in:
- lib/kame/remocon/opal/turtle.rb
Instance Attribute Summary collapse
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
- #canvas_coordinate ⇒ Object
-
#initialize(x, y) ⇒ Pos
constructor
A new instance of Pos.
- #move_to(x, y) ⇒ Object
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
#x ⇒ Object (readonly)
Returns the value of attribute x.
10 11 12 |
# File 'lib/kame/remocon/opal/turtle.rb', line 10 def x @x end |
#y ⇒ Object (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_coordinate ⇒ Object
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 |