class Goby::Tile
Describes a single location on a Map
. Can have Events and Monsters. Provides variables that control its graphical representation on the Map
.
Constants
- DEFAULT_IMPASSABLE
Default graphic for impassable tiles.
- DEFAULT_PASSABLE
Default graphic for passable tiles.
Attributes
description[RW]
events[RW]
graphic[RW]
monsters[RW]
passable[RW]
seen[RW]
Public Class Methods
new(passable: true, seen: false, description: "", events: [], monsters: [], graphic: nil)
click to toggle source
@param [Boolean] passable if true, the player can move here. @param [Boolean] seen if true, it will be printed on the map. @param [String] description a summary/message of the contents. @param [[Event]] events the events found on this tile. @param [[Monster]] monsters the monsters found on this tile. @param [String] graphic the respresentation of this tile graphically.
# File lib/goby/map/tile.rb, line 18 def initialize(passable: true, seen: false, description: "", events: [], monsters: [], graphic: nil) @passable = passable @seen = seen @description = description @events = events @monsters = monsters @graphic = graphic.nil? ? default_graphic : graphic end
Public Instance Methods
clone()
click to toggle source
to_s()
click to toggle source
Convenient conversion to String
.
@return [String] the string representation.
# File lib/goby/map/tile.rb, line 40 def to_s return @seen ? @graphic + " " : " " end
Private Instance Methods
default_graphic()
click to toggle source
Returns the default graphic by considering passable.
# File lib/goby/map/tile.rb, line 49 def default_graphic return @passable ? DEFAULT_PASSABLE : DEFAULT_IMPASSABLE end