setLevelEditor(editor)engineEditor.js:301Make 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:301Make 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:295The level editor, levelEditor.open() to edit the level, levelEditor.close() to play on with the changes
EditorEdit2D : ObjectengineEditor.js:61The 2D level editor's edit functions, levelEditor.edit2D
map Object|undefinedThe Tiled map of the selected layer
layer TileLayer|undefinedThe selected tile layer, undefined on an object layer
objects Array<Object>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
paint functionSet a cell of the selected tile layer to a tile index, -1 erases, with a direction 0 to 3 and a mirror; false off the layer or with none
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
undo functionUndo, or redo with true
toJSON functionThe map as the text Save writes
EditorEdit3D : ObjectengineEditor.js:80The 3D level editor's edit functions, levelEditor.edit3D; a position, a rotation and a scale are Vector3, the rotation in degrees
level Object|undefinedThe level object being edited
objects Array<Object>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
changePart functionEdit the level's scene, voxels, terrain or prefabs block
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 or the level can not be edited
setTransform functionWrite a place, a rotation and a scale on an object of the list given to change; one left out is kept
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
undo functionUndo, or redo with true
toJSON functionThe level as the text Save writes
EditorPlayFromCallback(pos)engineEditor.js:15pos anyWhere to start playing, a Vector2 from the 2D editor and a Vector3 from the 3D one
EditorRestartCallback()engineEditor.js:21EditorTileCallback(layer, pos, tile)engineEditor.js:26EditorTool : ObjectengineEditor.js:47A 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:34What 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