Public Functions:Asset Placement Functions
Asset placement functions include a set of methods for moving one Tangible classed asset into or out of an Aspect of another asset. Aspects are containers representing in, on, under, behind, or attached.
- MyGame.$("asset").to("on","asset name") {String} aspect a preposition representing an aspect {String} asset a name or id representing an asset MyGame.$("asset").to({ on: "asset name" }) {Object} an object with one property where the key is an aspect and the value is an asset name or id Boolean This method sends one asset into the specified aspect of another asset, for instance MyGame.$("sword").to("in", "scabbard"). Note that this method bypasses the usual behavior that calls verb actions, so for instance if scabbard.doMoveThatToThis("sword") were set to a custom function, that function would not be called by to(). If you wanted the verb action to be called, you could instead use MyGame.$("sword").moveTo("scabbard"), which does invoke verb actions.
- MyGame.$("asset").from("asset name") {String} asset a name or id representing an asset Boolean This method moves one asset away from another asset, without specifying a new destination. For instance MyGame.$("sword").from("scabbard") would result in the sword being moved into no place, a limbo outside of the game world. Note that this method bypasses the usual behavior that calls verb actions, so for instance if scabbard.doRemoveThatFromThis("sword") were set to a custom function, that function will not be called by from. If you wanted that function to be called, you could instead use MyGame.$("sword").moveFrom("scabbard"), which does invoke verb actions.
.move() alternate
These methods are convenience aliases. They use .move() instead
of .$(), which does exactly the same thing, which is to say
that it gets an asset and lets you chain a second function call. Feel free
to use these if you find them easier to remember.
-
MyGame.move("asset").to("on","asset
name")
{String}
aspect a preposition representing an
aspect
{String}
asset a name or id representing an
asset
MyGame.move("asset").to({ on: "asset"
})
{Object} an object with one property
where the key is an aspect and the value is an asset name or id
Boolean
This method sends one asset into the specified aspect of another asset,
for instance
MyGame.$("sword").to("in", "scabbard"). Note that
this method bypasses the usual behavior that calls
verb actions, so for
instance if
scabbard.doMoveThatToThis("sword") were set to a
custom function, that function would not be called by
to(). If you wanted the verb action to be called,
you could instead use
MyGame.$("sword").moveTo("scabbard"), which does
invoke verb actions.
MyGame.move("asset").to("asset")is functionally identical toMyGame.$("asset").to("asset"). It's offered as an alias. -
MyGame.move("asset").from("asset
name")
{String}
asset a name or id representing an
asset
Boolean
This method moves one asset away from another asset, without specifying
a new destination. For instance
MyGame.move("sword").from("scabbard") would result
in the sword being moved into no place, a limbo outside of the game
world. Note that this method bypasses the usual behavior that calls
verb actions, so for
instance if
scabbard.doRemoveThatFromThis("sword") were set to
a custom function, that function will not be called by
from. If you wanted that function to be called,
you could instead use
MyGame.$("sword").moveFrom("scabbard"), which does
invoke verb actions.
MyGame.move("asset").from("asset")is functionally identical toMyGame.$("asset").from("asset"). It's offered as an alias.