Class: SnakeGame::Position
- Inherits:
-
Object
- Object
- SnakeGame::Position
- Includes:
- Constants
- Defined in:
- lib/position.rb
Overview
Class for storing coordinates
Constant Summary
Constants included from Constants
Constants::EVASION, Constants::FPS, Constants::HEIGHT, Constants::NEXTLEVEL, Constants::STEP, Constants::WIDTH
Instance Attribute Summary collapse
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Instance Method Summary collapse
- #+(other) ⇒ Object
- #==(other) ⇒ Object
-
#initialize(x, y) ⇒ Position
constructor
A new instance of Position.
Constructor Details
#initialize(x, y) ⇒ Position
Returns a new instance of Position.
8 9 10 11 |
# File 'lib/position.rb', line 8 def initialize(x, y) @x = x @y = y end |
Instance Attribute Details
#x ⇒ Object
Returns the value of attribute x.
7 8 9 |
# File 'lib/position.rb', line 7 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
7 8 9 |
# File 'lib/position.rb', line 7 def y @y end |