Class: Tile
- Inherits:
-
Object
- Object
- Tile
- Defined in:
- lib/lib/user_interface/tile.rb
Instance Attribute Summary collapse
-
#infopane ⇒ Object
Returns the value of attribute infopane.
-
#terrain ⇒ Object
Returns the value of attribute terrain.
-
#unit ⇒ Object
Returns the value of attribute unit.
Instance Method Summary collapse
- #draw ⇒ Object
-
#initialize(x, y, loaded_symbol, infopane) ⇒ Tile
constructor
A new instance of Tile.
Constructor Details
#initialize(x, y, loaded_symbol, infopane) ⇒ Tile
Returns a new instance of Tile.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/lib/user_interface/tile.rb', line 10 def initialize(x, y, loaded_symbol, infopane) dir_path = File.dirname(__FILE__) @x = x @y = y @infopane = infopane case(loaded_symbol) when SYMBOL_SEA then @terrain = TILE_SEA @image = Gosu::Image.new(dir_path + '/../../media/sea.png') when SYMBOL_GROUND then @terrain = TILE_GROUND @image = Gosu::Image.new(dir_path + '/../../media/ground.png') else abort("tile.initialize(): Unknown terrain symbol (#{loaded_symbol})") end end |
Instance Attribute Details
#infopane ⇒ Object
Returns the value of attribute infopane.
8 9 10 |
# File 'lib/lib/user_interface/tile.rb', line 8 def infopane @infopane end |
#terrain ⇒ Object
Returns the value of attribute terrain.
8 9 10 |
# File 'lib/lib/user_interface/tile.rb', line 8 def terrain @terrain end |
#unit ⇒ Object
Returns the value of attribute unit.
8 9 10 |
# File 'lib/lib/user_interface/tile.rb', line 8 def unit @unit end |