Documentation > Levels > LevelManager
Version: 2.7
LevelManager.new()
This function create a new instance of LevelManager.
Return
Returns an instance of LevelManager.
LevelManager:load(File)
This function loads a given map file.
File
Path and name of the map to load.
LevelManager:draw()
This function draws the map.
LevelManager:getOpacity(Item)
This function returns the opacity of a given item (layer or object).
Item
Item (layer or object) to get the opacity.
Return
Returns the opacity of the given item (layer or object).
LevelManager:setOpacity(Item, Opacity)
This function set the opacity of the given item (layer or object).
Item
Item (layer or object) on which the opacity is modified.
Opacity
New value of opacity to apply.
LevelManager:restoreOpacity(Item)
This function restores the opacity of the given item (layer or object).
Item
Item (layer or object) on which opacity is restored.
LevelManager:setAllOpacity(Opacity)
This function sets the opacity of all layers and objects to the given value.
Opacity
New value of opacity.
LevelManager:restoreAllOpacity()
This function restores the opacity of all layers and objects.
LevelManager:getLayerByName(Name)
This function returns a layer found by its name. Do not work with a name of a group.
Name
Name of the layer.
Return
Returns a layer found by its name; nil otherwise. Do not work with a name of a group.
LevelManager:getLayersByGroup(GroupName)
This function returns all layers of a group found by its name.
Name
Name of a group.
Return
Returns all layers of a group found by its name.
LevelManager:getObjectByName(Name)
This function returns an object found by its name.
Name
Name of the object to find.
Return
Returns an object found by its name; nil otherwise.
LevelManager:getAllObjectsByClass(Class)
This function is a shortcut to retreive all objects of the given class.
Class
class of object to retreive.
Return
Returns all objects of the given class.
LevelManager:getAllObjectsByShape(Shape)
This function is a shortcut to retreive all objects of the given shape.
Shape
Shape of object to retreive.
Return
Returns all objects of the given shape.
LevelManager:getObjectsInGroup(GroupName)
This function returns all objects of a group retreived by the given name.
GroupName
Name of the group.
Return
Returns all objects of a group retreived by the given name.
LevelManager:getObjectsOnGrid(Row, Col)
This function returns all objects at the given cell coordonates. Row and Col should be inside the grid.
Row
Row of the cell.
Col
Column of the cell.
Return
Returns all objects at the given cell coordonates.
LevelManager:getObjectsAtCoord(X, Y)
This function returns all objects at the given coordonates.
X
Position on the X-axis.
Y
Position on the Y-axis.
Return
Returns all objects at the given coordonates.
LevelManager:getDimensions()
This function returns the number of columns and rows of the grid and the width (in pixels) and height (in pixels) of each cell.
Return
Returns the number of columns, the number of rows of the grid, the width (in pixels) and height (in pixels) of each cell.
LevelManager:getMapDimensions()
This function returns the width and height in pixels of the map with the scale.
Return
Returns returns the width and height in pixels of the map with the scale.
LevelManager:centerMap(X, Y)
This function center the map on the given coordonates.
X
Position on the X-axis.
Y
Position on the Y-axis.
LevelManager:getTileIdAtPos(Layer, Row, Col)
This function returns the tile id at the given grid coordonate in the given layer.
Layer
Layer to retreive the id.
Row
Row of the cell.
Col
Col of the cell.
Return
Returns the tile id at the given grid coordonate in the given layer.
LevelManager:getTileIdsAtCoord(X, Y)
This function returns the id of the tiles at the given position. The objects are excluded.
X
Position on the X-axis.
Y
Position on the Y-axis.
Return
Returns the id of all tiles at the given position. The objects are excluded.
LevelManager:setTileIdAtPos(Layer, Row, Col, ImgId, Force)
This function sets the tile id at the given cell coordonate on the given layer by the given id. Must be forced if the new id is 0.
Layer
Layer to modify
Row
Row of the cell.
Col
Col of the cell.
ImgId
Id of the new image inside one of the tilesets.
Force
Force the change of the id. Mandatory if the new id is 0.
LevelManager:restoreTileIdAtPos(Layer, Row, Col)
This function restores the tile id at the given cell coordonate on the given layer.
Layer
Layer to restore.
Row
Row of the cell.
Col
Col of the cell.
LevelManager:getImageId(Object)
This function gets the image id of the given object.
Object
Object to set the image.
LevelManager:setImageId(Object, ImgId)
This function sets the image id of the given object by the given image id if the image id is valid.
Object
Object to set the image.
ImgId
New image id for the object.
LevelManager:restoreObjectImageId(Object)
This function restores the image id of the given object.
Object
Object to restore.
LevelManager:setOffset(OffsetX, OffsetY)
This function set the offsets.
OffsetX
OffsetX
OffsetY
OffsetY
LevelManager:getOffset()
This function returns the offsets.
Return
Returns the offsets.
LevelManager:setScale(ScaleX, ScaleY)
This function sets the scales.
ScaleX
ScaleX
ScaleY
ScaleY
LevelManager:getScale()
This function returns the scale.
Return
Returns the scale.
LevelManager:setVisible(Visible)
This function set the level visible (true) or not (false).
LevelManager:getVisible()
This function returns if the level is visible (true) or not (false).
Return
Returns if the level is visible (true) or not (false).
LevelManager:convertRowColToCoord(Row, Col)
This function converts the given cell coordonate to X,Y coordonate.
Row
Row of the cell.
Col
Column of the cell.
Return
Returns the X,Y coordonate from the cell coordonate.
LevelManager:convertCoordToRowCol(X, Y)
This function converts a X,Y coordonate to cell coordonate.
X
Position on the X-axis.
Y
Position on the Y-axis.
Return
Returns the row and column of the cell at the given X,Y coordonate.
LevelManager:reload()
This function reloads all datas of all layers and objects.
LevelManager:restoreObject(Object)
This function restore the given object at its original values.
Object
Object to be restored.
LevelManager:restoreObjects()
This function restore all objects at their original values.
LevelManager:toString(NoTitle)
This function display all variables containing in the current LevelManager instance (tables and functions are excluded).
NoTitle
Indicates if the title must be displayed (false) or not (true).
Me contacter