Class: Demiurge::DSL::TmxLocationBuilder
- Inherits:
-
LocationBuilder
- Object
- ActionItemBuilder
- LocationBuilder
- Demiurge::DSL::TmxLocationBuilder
- Defined in:
- lib/demiurge/tmx.rb
Overview
Special builder for tmx_location blocks
Constant Summary
Constants inherited from ActionItemBuilder
ActionItemBuilder::LEGAL_OPTIONS
Instance Method Summary collapse
-
#built_item ⇒ Object
Validate built_item before returning it.
-
#initialize(name, engine, options = {}) ⇒ TmxLocationBuilder
constructor
Constructor.
-
#manasource_tile_layout(tmx_spec) ⇒ Object
Specify a TMX file as the tile layout, and interpret it according to ManaSource TMX conventions.
-
#tile_layout(tmx_spec) ⇒ Object
Specify a TMX file as the tile layout, but assume relatively little about the TMX format.
Methods inherited from LocationBuilder
Methods inherited from ActionItemBuilder
#__state_internal, #define_action, #display, #every_X_ticks, #on_intention, #on_notification, #position, #state
Constructor Details
#initialize(name, engine, options = {}) ⇒ TmxLocationBuilder
Constructor
52 53 54 55 |
# File 'lib/demiurge/tmx.rb', line 52 def initialize(name, engine, = {}) ["type"] ||= "TmxLocation" super end |
Instance Method Details
#built_item ⇒ Object
Validate built_item before returning it
74 75 76 77 |
# File 'lib/demiurge/tmx.rb', line 74 def built_item raise("A TMX location (name: #{@name.inspect}) must have a tile layout!") unless @state["tile_layout"] || @state["manasource_tile_layout"] super end |
#manasource_tile_layout(tmx_spec) ⇒ Object
Specify a TMX file as the tile layout, and interpret it according to ManaSource TMX conventions.
66 67 68 69 70 71 |
# File 'lib/demiurge/tmx.rb', line 66 def manasource_tile_layout(tmx_spec) # Make sure this loads correctly, but use the cache for efficiency. TmxLocation.tile_cache_entry(tmx_spec, nil) @state["manasource_tile_layout"] = tmx_spec end |
#tile_layout(tmx_spec) ⇒ Object
Specify a TMX file as the tile layout, but assume relatively little about the TMX format.
58 59 60 61 62 63 |
# File 'lib/demiurge/tmx.rb', line 58 def tile_layout(tmx_spec) # Make sure this loads correctly, but use the cache for efficiency. TmxLocation.tile_cache_entry(nil, tmx_spec) @state["tile_layout"] = tmx_spec end |