Class: SnakeGame::GameObject
- Inherits:
-
Object
- Object
- SnakeGame::GameObject
- Defined in:
- lib/game_object.rb
Overview
Base class for all game objects
Instance Attribute Summary collapse
-
#image ⇒ Object
Returns the value of attribute image.
-
#position ⇒ Object
Returns the value of attribute position.
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(position, image) ⇒ GameObject
constructor
A new instance of GameObject.
Constructor Details
#initialize(position, image) ⇒ GameObject
Returns a new instance of GameObject.
8 9 10 11 |
# File 'lib/game_object.rb', line 8 def initialize(position, image) @position = position @image = image end |
Instance Attribute Details
#image ⇒ Object
Returns the value of attribute image.
6 7 8 |
# File 'lib/game_object.rb', line 6 def image @image end |
#position ⇒ Object
Returns the value of attribute position.
6 7 8 |
# File 'lib/game_object.rb', line 6 def position @position end |
Instance Method Details
#draw ⇒ Object
13 14 15 |
# File 'lib/game_object.rb', line 13 def draw @image.draw @position.x, @position.y, 0 end |