Class: Demiurge::DSL::TmxLocationBuilder

Inherits:
LocationBuilder show all
Defined in:
lib/demiurge/tmx.rb

Overview

Special builder for tmx_location blocks

Since:

  • 0.0.1

Constant Summary

Constants inherited from ActionItemBuilder

ActionItemBuilder::LEGAL_OPTIONS

Instance Method Summary collapse

Methods inherited from LocationBuilder

#agent, #description

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

Since:

  • 0.0.1



70
71
72
73
# File 'lib/demiurge/tmx.rb', line 70

def initialize(name, engine, options = {})
  options["type"] ||= "TmxLocation"
  super
end

Instance Method Details

#built_itemObject

Validate built_item before returning it

Since:

  • 0.0.1



88
89
90
91
92
93
# File 'lib/demiurge/tmx.rb', line 88

def built_item
  raise("A TMX location (name: #{@name.inspect}) must have a tile layout!") unless @state["tile_layout_filename"]
  item = super
  item.tile_cache_entry  # Load the cache entry, make sure it works without error
  item
end

#manasource_tile_layout(tmx_spec) ⇒ Object

Specify a TMX file as the tile layout, and interpret it according to ManaSource TMX conventions.

Since:

  • 0.0.1



82
83
84
85
# File 'lib/demiurge/tmx.rb', line 82

def manasource_tile_layout(tmx_spec)
  @state["tile_layout_filename"] = tmx_spec
  @state["tile_layout_type"] = "manasource"
end

#tile_layout(tmx_spec) ⇒ Object

Specify a TMX file as the tile layout, but assume relatively little about the TMX format.

Since:

  • 0.0.1



76
77
78
79
# File 'lib/demiurge/tmx.rb', line 76

def tile_layout(tmx_spec)
  @state["tile_layout_filename"] = tmx_spec
  @state["tile_layout_type"] = "tmx"
end