Class: Aspect
Extends: adventurejs.Atom
Defined in: adventure/assets/Aspect.js, line 6
How to: UseAspects
Aspect is a special class that creates spaces within any Tangible Asset, which can contain other Tangibles and/or Substances, with the addition of a Vessel. The five most commonly used aspects are behind, in, on, under, and attached, and a lot of default logic is predicated on using one of these. However it is possible to create aspects at any preposition. Just note that it might lead to unexpected results and require custom code.
this.can_put.behind = {};
Here is an example of how to set the properties of a Aspect of an existing class using createAsset. If you use a preposition that hasn't been defined for the class you're using, a new Aspect will be constructed automatically during construction.
MyGame.createAsset({
class: "Desk",
name: "desk",
place: { in: "Office" },
behind: {
list_in_room: false,
list_in_examine: true,
maxheight: 1,
maxwidth: 6,
maxdepth: 4,
}
});
To define a new class with an Aspect, use the Aspect constructor within the class constructor. Here is a very simple example of a new class with a behind Aspect.
function NewClass( name, game_name )
{
this.Tangible_constructor( name, game_name );
this.can_put.newaspect = new adventurejs.Aspect( "newaspect", this.game_name )
.set({
"parent_id": this.id,
});
}
var p = adventurejs.extend(NewClass, adventurejs.Tangible);
adventurejs.Bowl = adventurejs.promote(NewClass, "Tangible");
}());
Private Constructor:
var foo = new adventurejs.Aspect(game_name, name)
Parameters:
-
game_name
String
Name of top level game instance that is scoped to window. -
name
String
Instance name.
Index
Methods:
- Inherited from Atom getInheritance
- Inherited from Atom getProperty
- Inherited from Atom hasClass
- Inherited from Atom hasProperty
- Inherited from Atom set
Properties:
- can_hold_player
- Inherited from Atom class
- Inherited from Atom game
- Inherited from Atom game_name
- Inherited from Atom id
- is_false_nest
- Inherited from Atom name
- orientation
- player_can_climb
- player_can_crawl
- player_can_float
- player_can_fly
- player_can_hide
- player_can_hover
- player_can_jump
- player_can_kneel
- player_can_lie
- player_can_nest
- player_can_reach
- player_can_reach
- player_can_run
- player_can_sit
- player_can_slither
- player_can_stand
- player_can_step
- player_can_swim
- player_can_walk
- player_posture
- player_preposition
- things_player_can_reach_from_positions_of_this_aspect
- Inherited from Atom UID
Methods Collapse all |
Defined in: adventure/Atom.js, line 238
Inherited from: adventurejs.Atom#getInheritance
Returns:
Array
Defined in: adventure/Atom.js, line 184
Inherited from: adventurejs.Atom#getProperty
Parameters:
-
prop
String
Name of the property to test for. Can include dot notation.
if(false === foo.bar.baz)
comparisons.
Returns:
Boolean
Defined in: adventure/Atom.js, line 216
Inherited from: adventurejs.Atom#hasClass
Parameters:
-
prop
String
Name of the classe to test for.
Returns:
Boolean
Defined in: adventure/Atom.js, line 148
Inherited from: adventurejs.Atom#hasProperty
Parameters:
-
prop
String
Name of the property to test for. Can include dot notation.
Returns:
Boolean
Defined in: adventure/Atom.js, line 134
Inherited from: adventurejs.Atom#set
Parameters:
-
props
Object
A generic object containing properties to copy to the Object instance.
Returns:
Object
Returns the instance the method is called on (useful for chaining calls.)
Properties Collapse all |
Defined in: adventure/Atom.js, line 74
Inherited from: adventurejs.Atom#class
Defined in: adventure/Atom.js, line 123
Inherited from: adventurejs.Atom#game
this.game
.
Defined in: adventure/Atom.js, line 100
Inherited from: adventurejs.Atom#game_name
Defined in: adventure/Atom.js, line 86
Inherited from: adventurejs.Atom#id
Defined in: adventure/Atom.js, line 54
Inherited from: adventurejs.Atom#name
Defined in: adventure/assets/Aspect.js, line 113
Default value: "horizontal"
Defined in: adventure/assets/Aspect.js, line 123
Defined in: adventure/assets/Aspect.js, line 255
Todos: for this to work properly each aspect needs its own local coordinates
Defined in: adventure/Atom.js, line 93
Inherited from: adventurejs.Atom#UID