Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
Tutorial showing a list of asset getter functions. tutorial, custom code, public functions, getter

Public Functions:Asset Getter Functions

Asset getter functions return useful information about assets of the Tangible class.

  • MyGame.$("asset").room()   Object This method returns the object of the Room that the specified asset is in. Returns false if the asset has no room (which would only be the case if it was in limbo). Note that this method only works for assets in the Tangible class tree, and will return null for other asset classes.
  • MyGame.$("asset").parent()   Object This method returns the object of the asset that the specified asset is in/on/under/behind(etc). If the asset has no parent but is in a room, the room will be returned. Returns false if the asset has no parent (which would only be the case if it was in limbo). Note that this method only works for assets in the Tangible class tree, and will return null for other asset classes.
  • MyGame.$("asset").contents("in") {String} aspect a preposition, aka attached / behind / in / on / under or "all" Array This is a method to get the contents of an asset's aspect. Takes a preposition and returns asset.aspects[aspect].contents. Can take "all" as a param and will return the contents of all aspects. Returns false if the asset doesn't have the specified aspect. This is a shallow list that doesn't return nested assets.