Class:Platonic
Extends: adventurejs.Atom
Defined in: adventure/Platonic.js, line 4
Constructor:
MyGame.createAsset({ "class":"Platonic", "name":"foo" })
Description
Platonic is subclassed from the foundational class Atom, and is used to make platonic assets, which are stand-ins for one-from-many assets, such as one grape from a bunch of grapes or one nut from a sack of nuts. Platonic assets are never instantiated by authors - they're created automatically any time an asset is set to dispense.
Example:
MyGame.createAsset({
class: "Pouch",
name: "small pouch",
place: { in: "Nomad" },
synonyms: ["leather", "lace", "strip", "pistachio", "pistachios"],
description: `A tiny pouch – really, hardly more than a scrap of leather – folded on itself and laced with a thin strip. The pouch contains a handful of pistachios. `,
is: { closed: false },
aspects: {
in: {
dispense: "Pistachio",
},
},
});
MyGame.createClass({
class: "Pistachio",
extend: "Edible",
singular: "pistachio",
plural: "pistachios",
description: `It's a pistachio. `,
});
Private Constructor:
var foo = new adventurejs.Platonic(game_name, name)
Though all in-game glasses use a standard constructor method under the hood, it's unlikely that you'd need to call it directly. To create an instance of the Platonic class, it must be defined in a game file as a generic object. That object will be used at runtime to construct a new game class instance, which will be validated and initialized before adding it to the Game. See above for the public constructor, or see Game#createAsset to learn more.
Parameters:
-
game_nameString
The name of the top level game object. -
nameString
A name for the object, to be serialized and used as ID.
- Index
- Methods
- Properties
Index
Methods:
- Inherited from Atom getClassInheritance
- Inherited from Atom hasClass
- initialize
- Inherited from Atom Overrides from Atom set
- validate
Properties:
Methods Collapse all |
getClassInheritance
getClassInheritance() → {Array}
Defined in: adventure/Atom.js, line 191
Inherited from: adventurejs.Atom#getClassInheritance
Returns:
Array
hasClass
hasClass(prop) → {Boolean}
Defined in: adventure/Atom.js, line 171
Inherited from: adventurejs.Atom#hasClass
Parameters:
-
propString
Name of the class to test for.
Returns:
Boolean
initialize
initialize()
Defined in: adventure/Platonic.js, line 76
set
set(props) → {Object}
Defined in: adventure/Atom.js, line 159
Overrides from: adventurejs.Atom#set
Parameters:
-
propsObject
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.)
validate
validate()
Defined in: adventure/Platonic.js, line 68
Properties |
game
game :Getter
Defined in: adventure/Atom.js, line 138
Inherited from: adventurejs.Atom#game
this.game.
id
id :String
Defined in: adventure/Atom.js, line 114
Inherited from: adventurejs.Atom#id
name
name :String
Defined in: adventure/Atom.js, line 62
Overrides from: adventurejs.Atom#name
Name
Name :String
Defined in: adventure/Atom.js, line 125
Inherited from: adventurejs.Atom#Name