setLevelEditor(editor)engineEditor.js:367Make a level editor of the game's own the one in use: an instance of a class that extends LevelEditor, with the game's hooks as its methods; set it before the editor opens
editorLevelEditor
LittleJS Level Editor
setLevelEditor(editor)engineEditor.js:367Make a level editor of the game's own the one in use: an instance of a class that extends LevelEditor, with the game's hooks as its methods; set it before the editor opens
editor LevelEditorlevelEditor : LevelEditorengineEditor.js:361The level editor, levelEditor.open() to edit the level, levelEditor.close() to play on with the changes
EditorEdit2D : ObjectengineEditor.js:64The 2D level editor's edit functions, levelEditor.edit2D
map TiledMap|undefinedThe Tiled map of the selected layer
layer TileLayer|undefinedThe selected tile layer, undefined on an object layer
objects Array<TiledObject>A copy of the selected object layer's objects, as Tiled has them
hover Vector2|undefinedThe cell under the mouse on the selected tile layer
selection Set<number>The selected objects' ids
changeObjects functionEdit a copy of the selected object layer's objects; false when nothing changed
strokeEnd functionEnd the edit: one undo step, and the autosave
strokeCancel functionTake the edit being made back
bulk functionMany paints with one redraw a layer
toJSON functionThe map as the text Save writes
EditorEdit3D : ObjectengineEditor.js:143The 3D level editor's edit functions, levelEditor.edit3D; a position, a rotation and a scale are Vector3, the rotation in degrees
level Level3D|undefinedThe level object being edited
objects Array<Level3DObject>Its objects, the list in the level: read it, edit through change
selection Set<number>The selected objects' ids
selected functionThe selected objects
made functionWhat the game made for an object's id
change functionEdit a copy of the object list; false when nothing changed, or when the level can not be edited while its autosave waits for Apply or Drop
changePart functionEdit the level's scene, voxels, terrain or prefabs block; false as change gives it
strokeEnd functionEnd the edit: one undo step, and the autosave
strokeCancel functionTake the edit being made back
place functionAdd an object of a type at a position, selected; its id, undefined when there is no such type, a prefab would hold itself, or the level can not be edited while its autosave waits for Apply or Drop
setProperty functionWrite a property on an object of the list given to change, left out of the file when it is the type's default
pos functionAn object's position
rotation functionIts rotation, in degrees
scale functionIts scale
mousePoint functionWhere the mouse is on the level or the ground, undefined over the panel
toJSON functionThe level as the text Save writes
EditorPlayFromCallback(pos) → voidengineEditor.js:15EditorRestartCallback() → voidengineEditor.js:22EditorTileCallback(layer, pos, tile) → voidengineEditor.js:28EditorTool : ObjectengineEditor.js:50A tool of the game's own for the level editor, see LevelEditor.addTool; P is the type of its pos, as EditorToolAt has it
key string optionalThe key that picks it, as addKey spells one
hint string optionalThe hint line while it is on
onPress function optionalThe left button went down in the level; returning false says the press was not the tool's
onDrag function optionalEach frame it is held
onRelease function optionalIt was let go
onDraw function optionalEach frame the tool is on, to draw its cursor or preview
EditorToolAt : ObjectengineEditor.js:37What the level editor gives the callbacks of a tool of the game's own; P is the type of pos, a Vector2 for a 2D tool, the default, and Vector3|undefined for a 3D one
pos PWhere the mouse is in the level: a Vector2 in the 2D editor; in the 3D one a Vector3 on the level or the ground, undefined when the mouse is over the panel
cell Vector2|undefined2D: the tile cell under the mouse on the selected tile layer
ray Ray3D|undefined3D: the mouse's Ray3D
shift booleanIs Shift held
ctrl booleanIs Ctrl held