Public Functions:Asset.isAspect Functions
This is an alternate way of asking whether one asset is in or on or under or
behind another aspect. These are functionally equivalent to using
asset.$is(). You're welcome to use whichever version you prefer.
Note that these methods only work for assets in the
Tangible class tree, and will
return false for non-tangible asset classes.
-
MyGame.$("asset").isAttached("asset
name")
{String}
asset a name or id representing an
asset
Boolean
This is a shortcut method to ask whether one asset is specifically in
the
attachedaspect of another aspect, ignoring nested assets. This is functionally identical to usingMyGame.$("asset").$is("attached", "other asset"). -
MyGame.$("asset").isBehind("asset
name")
{String}
asset a name or id representing an
asset
Boolean
This is a shortcut method to ask whether one asset is specifically in
the
behindaspect of another aspect, ignoring nested assets. This is functionally identical to usingMyGame.$("asset").$is("behind", "other asset"). -
MyGame.$("asset").isIn("asset
name")
{String}
asset a name or id representing an
asset
Boolean
This is a shortcut method to ask whether one asset is specifically in
the
inaspect of another aspect, ignoring nested assets. This is functionally identical to usingMyGame.$("asset").$is("in", "other asset"). -
MyGame.$("asset").isOn("asset
name")
{String}
asset a name or id representing an
asset
Boolean
This is a shortcut method to ask whether one asset is specifically in
the
onaspect of another aspect, ignoring nested assets. This is functionally identical to usingMyGame.$("asset").$is("on", "other asset"). -
MyGame.$("asset").isUnder("asset
name")
{String}
asset a name or id representing an
asset
Boolean
This is a shortcut method to ask whether one asset is specifically in
the
underaspect of another aspect, ignoring nested assets. This is functionally identical to usingMyGame.$("asset").$is("under", "other asset"). - MyGame.$("asset").isWithin("asset name") {String} asset a name or id representing an asset Boolean This is a shortcut method to ask whether one asset is contained anywhere inside of another, inclusive of all of the parent asset's aspects. Which is to say, this will return true if the child asset is in or under or behind or on (or any other preposition) the parent asset, even if it's nested within other assets.
- MyGame.$("asset").has("asset name") {String} asset a name or id representing an asset Boolean This is the reverse way of asking asset.isWithin("other asset"), a shortcut method to ask whether one asset has another asset inside of it, inclusive of all of the parent asset's aspects. Which is to say, this will return true if the child asset is in or under or behind or on (or any other preposition) the parent asset. Whether you use assetA.isWithin(assetB) or assetB.has(assetA) is purely a matter of preference.
- MyGame.$("asset").doesContain("asset") {String} asset a name or id representing an asset Boolean This is a shortcut method to ask whether one asset contains a substance, ie: does the bucket contain water? (Though it will also return true for tangibles, ie: does the bucket contain the shovel?) While it's similar to isWithin(), it only does a shallow search that doesn't consider nested items.