mirror of
https://github.com/Reuh/ubiquitousse.git
synced 2025-10-27 17:19:31 +00:00
The component methods system was awkward and didn't give much benefit compared to just using methods on Systems. Plus now we really only have data in entities. Since we don't have component methods, the callback system had to be replaced; I integrated it with the default System methods since it's a relatively common behavior.
1862 lines
39 KiB
HTML
1862 lines
39 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
|
<head>
|
|
<title>Ubiquitousse reference</title>
|
|
<link rel="stylesheet" href="../ldoc_new.css" type="text/css" />
|
|
</head>
|
|
<body>
|
|
|
|
<div id="container">
|
|
|
|
<div id="product">
|
|
<div id="product_logo"></div>
|
|
<div id="product_name"><big><b></b></big></div>
|
|
<div id="product_description"></div>
|
|
</div> <!-- id="product" -->
|
|
|
|
|
|
<div id="main">
|
|
|
|
|
|
<!-- Menu -->
|
|
|
|
<div id="navigation">
|
|
<br/>
|
|
<h1>Ubiquitousse</h1>
|
|
|
|
|
|
<ul>
|
|
<li><a href="../index.html">Index</a></li>
|
|
</ul>
|
|
|
|
<h2>Contents</h2>
|
|
<ul>
|
|
<li><a href="#Functions">Functions</a></li>
|
|
<li><a href="#Entity_objects">Entity objects </a></li>
|
|
<li><a href="#Tileset_objects">Tileset objects </a></li>
|
|
<li><a href="#Layer_objects">Layer objects </a></li>
|
|
<li><a href="#Tile_objects">Tile objects </a></li>
|
|
<li><a href="#IntTile_objects">IntTile objects </a></li>
|
|
<li><a href="#Level_objects">Level objects </a></li>
|
|
<li><a href="#Project_objects">Project objects </a></li>
|
|
<li><a href="#CustomFields_objects">CustomFields objects </a></li>
|
|
</ul>
|
|
|
|
|
|
<h2>Modules</h2>
|
|
<ul class="nowrap">
|
|
<li><a href="../modules/ubiquitousse.html">ubiquitousse</a></li>
|
|
<li><a href="../modules/asset.html">asset</a></li>
|
|
<li><a href="../modules/ecs.html">ecs</a></li>
|
|
<li><strong>ldtk</strong></li>
|
|
<li><a href="../modules/scene.html">scene</a></li>
|
|
<li><a href="../modules/signal.html">signal</a></li>
|
|
<li><a href="../modules/timer.html">timer</a></li>
|
|
<li><a href="../modules/util.html">util</a></li>
|
|
</ul>
|
|
<h2>Topics</h2>
|
|
<ul class="">
|
|
<li><a href="../topics/README.md.html">README</a></li>
|
|
<li><a href="../topics/LICENSE.html">LICENSE</a></li>
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div id="content">
|
|
|
|
<h1>Module <code>ldtk</code></h1>
|
|
<p><a href="https://ldtk.io/">LDtk</a> level importer for Lua and drawing using LÖVE.</p>
|
|
<p> Support most LDtk features, and allow easy usage in LÖVE projects.</p>
|
|
|
|
<p> Every unit is in pixel in the API unless written otherwise.
|
|
Colors are reprsented as a table <code>{r,g,b}</code> where <code>r</code>,<code>b</code>,<code>g</code> in [0-1].</p>
|
|
|
|
<p> This modules returns a single function, <a href="../modules/ldtk.html#LDtk">LDtk</a>(path).</p>
|
|
|
|
<p> No mandatory dependency.
|
|
Optionally requires LÖVE <code>love.graphics</code> (drawing Image, SpriteBatch, Quad) for drawing only.</p>
|
|
<h3>Usage:</h3>
|
|
<ul>
|
|
<pre class="example">local ldtk = require("ubiquitousse.ldtk")
|
|
|
|
-- load ldtk project file
|
|
local project = ldtk("example.ldtk")
|
|
|
|
-- can define callbacks when loading: for example to setup entities defined in LDtk
|
|
local callbacks = {
|
|
onAddEntity = function(entity)
|
|
-- handle entity...
|
|
end
|
|
}
|
|
|
|
-- load every level, with callbacks
|
|
for _, lvl in ipairs(project.levels) do lvl:load(callbacks) end
|
|
|
|
function love.draw()
|
|
-- draw every level
|
|
for _, lvl in ipairs(project.levels) do lvl:draw() end
|
|
end
|
|
</pre>
|
|
</ul>
|
|
|
|
|
|
<h2><a href="#Functions">Functions</a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap><a href="#LDtk">LDtk (path)</a></td>
|
|
<td class="summary">Load a LDtk project.</td>
|
|
</tr>
|
|
</table>
|
|
<h2><a href="#Entity_objects">Entity objects </a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Entity.layer">Entity.layer</a></td>
|
|
<td class="summary"><a href="../modules/ldtk.html#Layer_objects">Layer</a> this entity belongs to.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Entity.identifier">Entity.identifier</a></td>
|
|
<td class="summary">The entity name.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Entity.x">Entity.x</a></td>
|
|
<td class="summary">X position of the entity relative to the layer.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Entity.y">Entity.y</a></td>
|
|
<td class="summary">Y position of the entity relative to the layer.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Entity.width">Entity.width</a></td>
|
|
<td class="summary">The entity width.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Entity.height">Entity.height</a></td>
|
|
<td class="summary">The entity height.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Entity.sx">Entity.sx</a></td>
|
|
<td class="summary">Scale factor on x axis relative to original entity size.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Entity.sy">Entity.sy</a></td>
|
|
<td class="summary">Scale factor on y axis relative to original entity size.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Entity.pivotX">Entity.pivotX</a></td>
|
|
<td class="summary">The entity pivot point x position relative to the entity.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Entity.pivotY">Entity.pivotY</a></td>
|
|
<td class="summary">The entity pivot point x position relative to the entity.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Entity.color">Entity.color</a></td>
|
|
<td class="summary">Entity color.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Entity.tile">Entity.tile</a></td>
|
|
<td class="summary">Tile associated with the entity, if any.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Entity.fields">Entity.fields</a></td>
|
|
<td class="summary">Map of <a href="../modules/ldtk.html#CustomFields_objects">CustomFields</a> of the entity.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Entity:draw">Entity:draw ()</a></td>
|
|
<td class="summary">Called for the entity when drawing the associated entity layer (you will likely want to redefine it).</td>
|
|
</tr>
|
|
</table>
|
|
<h2><a href="#Tileset_objects">Tileset objects </a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Tileset.image">Tileset.image</a></td>
|
|
<td class="summary">The tileset LÖVE image object.</td>
|
|
</tr>
|
|
</table>
|
|
<h2><a href="#Layer_objects">Layer objects </a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Layer:draw">Layer:draw ()</a></td>
|
|
<td class="summary">Draw the current layer.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Layer.level">Layer.level</a></td>
|
|
<td class="summary"><a href="../modules/ldtk.html#Level_objects">Level</a> this layer belongs to.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Layer.identifier">Layer.identifier</a></td>
|
|
<td class="summary">The layer name.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Layer.type">Layer.type</a></td>
|
|
<td class="summary">Type of layer: IntGrid, Entities, Tiles or AutoLayer.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Layer.visible">Layer.visible</a></td>
|
|
<td class="summary">Whether the layer is visible or not.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Layer.opacity">Layer.opacity</a></td>
|
|
<td class="summary">The layer opacity (0-1).</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Layer.order">Layer.order</a></td>
|
|
<td class="summary">The layer order: smaller order means it is on top.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Layer.offsetX">Layer.offsetX</a></td>
|
|
<td class="summary">X position of the layer relative to the level.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Layer.offsetY">Layer.offsetY</a></td>
|
|
<td class="summary">Y position of the layer relative to the level.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Layer.gridSize">Layer.gridSize</a></td>
|
|
<td class="summary">Size of the grid on this layer.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Layer.gridWidth">Layer.gridWidth</a></td>
|
|
<td class="summary">Width of the layer, in grid units.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Layer.gridHeight">Layer.gridHeight</a></td>
|
|
<td class="summary">Height of the layer, in grid units.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Layer.entities">Layer.entities</a></td>
|
|
<td class="summary"><em>(Entities layer only)</em> List of <a href="../modules/ldtk.html#Entity_objects">Entity</a> in the layer.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Layer.tiles">Layer.tiles</a></td>
|
|
<td class="summary"><em>(Tiles, AutoLayer, or IntGrid with AutoLayer rules layers only)</em> List of <a href="../modules/ldtk.html#Tile_objects">Tile</a>s in the layer.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Layer.tileset">Layer.tileset</a></td>
|
|
<td class="summary"><em>(Tiles, AutoLayer, or IntGrid with AutoLayer rules layers only)</em> <a href="../modules/ldtk.html#Tileset_objects">Tileset</a> object associated with the layer.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Layer.spritebatch">Layer.spritebatch</a></td>
|
|
<td class="summary"><em>(Tiles, AutoLayer, or IntGrid with AutoLayer rules layers only)</em> <a href="https://love2d.org/wiki/SpriteBatch">LÖVE SpriteBatch</a> containing the layer.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Layer.intTiles">Layer.intTiles</a></td>
|
|
<td class="summary"><em>(IntGrid without AutoLayer rules layer only)</em> list of <a href="../modules/ldtk.html#IntTile_objects">IntTile</a>s in the layer.</td>
|
|
</tr>
|
|
</table>
|
|
<h2><a href="#Tile_objects">Tile objects </a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Tile.layer">Tile.layer</a></td>
|
|
<td class="summary"><a href="../modules/ldtk.html#Layer_objects">Layer</a> the tile belongs to.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Tile.x">Tile.x</a></td>
|
|
<td class="summary">X position of the tile relative to the layer.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Tile.y">Tile.y</a></td>
|
|
<td class="summary">Y position of the tile relative to the layer.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Tile.flipX">Tile.flipX</a></td>
|
|
<td class="summary">Whether the tile is flipped horizontally.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Tile.flipY">Tile.flipY</a></td>
|
|
<td class="summary">Whether the tile is flipped vertically.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Tile.tags">Tile.tags</a></td>
|
|
<td class="summary">Tags associated with the tile: can be used either as a list of tags or a map of activated tags tags[name] == true.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Tile.data">Tile.data</a></td>
|
|
<td class="summary">Custom data associated with the tile, if any.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Tile.quad">Tile.quad</a></td>
|
|
<td class="summary">Quad associated with the tile (relative to the layer’s tileset).</td>
|
|
</tr>
|
|
</table>
|
|
<h2><a href="#IntTile_objects">IntTile objects </a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap><a href="#IntTile.layer">IntTile.layer</a></td>
|
|
<td class="summary"><a href="../modules/ldtk.html#Layer_objects">Layer</a> the IntTile belongs to.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#IntTile.x">IntTile.x</a></td>
|
|
<td class="summary">X position of the IntTile relative to the layer.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#IntTile.y">IntTile.y</a></td>
|
|
<td class="summary">Y position of the IntTile relative to the layer.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#IntTile.identifier">IntTile.identifier</a></td>
|
|
<td class="summary">Name of the IntTile.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#IntTile.value">IntTile.value</a></td>
|
|
<td class="summary">Integer value of the IntTile.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#IntTile.color">IntTile.color</a></td>
|
|
<td class="summary">Color of the IntTile.</td>
|
|
</tr>
|
|
</table>
|
|
<h2><a href="#Level_objects">Level objects </a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Level:draw">Level:draw ()</a></td>
|
|
<td class="summary">Draw this level.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Level:load">Level:load ([, callbacks])</a></td>
|
|
<td class="summary">Load the level.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Level:unload">Level:unload ([, callbacks])</a></td>
|
|
<td class="summary">Unload the level.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Level.project">Level.project</a></td>
|
|
<td class="summary"><a href="../modules/ldtk.html#Project_objects">Project</a> this level belongs to.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Level.loaded">Level.loaded</a></td>
|
|
<td class="summary">Whether this level is currently loaded or not.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Level.identifier">Level.identifier</a></td>
|
|
<td class="summary">The level name.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Level.x">Level.x</a></td>
|
|
<td class="summary">The level x position.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Level.y">Level.y</a></td>
|
|
<td class="summary">The level y position.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Level.width">Level.width</a></td>
|
|
<td class="summary">The level width.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Level.height">Level.height</a></td>
|
|
<td class="summary">The level height.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Level.fields">Level.fields</a></td>
|
|
<td class="summary">Map of <a href="../modules/ldtk.html#CustomFields_objects">CustomFields</a> of the level (table).</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Level.layers">Level.layers</a></td>
|
|
<td class="summary">List of <a href="../modules/ldtk.html#Layer_objects">Layer</a>s in the level (table).</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Level.background">Level.background</a></td>
|
|
<td class="summary">Level background.</td>
|
|
</tr>
|
|
</table>
|
|
<h2><a href="#Project_objects">Project objects </a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Project.levels">Project.levels</a></td>
|
|
<td class="summary">List of <a href="../modules/ldtk.html#Level_objects">Level</a>s in this project.</td>
|
|
</tr>
|
|
</table>
|
|
<h2><a href="#CustomFields_objects">CustomFields objects </a></h2>
|
|
<table class="function_list">
|
|
</table>
|
|
<h3 class="doc-title"><a href="#CustomFields.conversion">Type conversion.</a></h3>
|
|
<table class="function_list">
|
|
</table>
|
|
|
|
<br/>
|
|
<br/>
|
|
|
|
|
|
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
|
|
|
<dl class="function">
|
|
<dt>
|
|
<a name = "LDtk"></a>
|
|
<strong>LDtk (path)</strong>
|
|
</dt>
|
|
<dd>
|
|
Load a LDtk project.
|
|
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">path</span>
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
|
|
to LDtk project file (.ldtk)
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
<span class="types"><a class="type" href="../modules/ldtk.html#Project_objects">Project</a></span>
|
|
the loaded LDtk project
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<h2 class="section-header has-description"><a name="Entity_objects"></a>Entity objects </h2>
|
|
|
|
<div class="section-description">
|
|
Entities are regular tables that get processed by <code>System</code>s. </p>
|
|
|
|
<p> The idea is that entities <em>should</em> only contain data and no code; it’s the systems that are responsible for the actual processing
|
|
(but it’s your game, do as you want).</p>
|
|
|
|
<p> This data is referred to, and organized in, “components”.
|
|
</div>
|
|
<dl class="function">
|
|
<dt>
|
|
<a name = "Entity.layer"></a>
|
|
<strong>Entity.layer</strong>
|
|
</dt>
|
|
<dd>
|
|
<a href="../modules/ldtk.html#Layer_objects">Layer</a> this entity belongs to.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>Layer</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Entity.identifier"></a>
|
|
<strong>Entity.identifier</strong>
|
|
</dt>
|
|
<dd>
|
|
The entity name.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>string</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Entity.x"></a>
|
|
<strong>Entity.x</strong>
|
|
</dt>
|
|
<dd>
|
|
X position of the entity relative to the layer.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Entity.y"></a>
|
|
<strong>Entity.y</strong>
|
|
</dt>
|
|
<dd>
|
|
Y position of the entity relative to the layer.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Entity.width"></a>
|
|
<strong>Entity.width</strong>
|
|
</dt>
|
|
<dd>
|
|
The entity width.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Entity.height"></a>
|
|
<strong>Entity.height</strong>
|
|
</dt>
|
|
<dd>
|
|
The entity height.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Entity.sx"></a>
|
|
<strong>Entity.sx</strong>
|
|
</dt>
|
|
<dd>
|
|
Scale factor on x axis relative to original entity size.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Entity.sy"></a>
|
|
<strong>Entity.sy</strong>
|
|
</dt>
|
|
<dd>
|
|
Scale factor on y axis relative to original entity size.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Entity.pivotX"></a>
|
|
<strong>Entity.pivotX</strong>
|
|
</dt>
|
|
<dd>
|
|
The entity pivot point x position relative to the entity.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Entity.pivotY"></a>
|
|
<strong>Entity.pivotY</strong>
|
|
</dt>
|
|
<dd>
|
|
The entity pivot point x position relative to the entity.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Entity.color"></a>
|
|
<strong>Entity.color</strong>
|
|
</dt>
|
|
<dd>
|
|
Entity color.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>table</code> {r,g,b} with r,g,b in [0-1]
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Entity.tile"></a>
|
|
<strong>Entity.tile</strong>
|
|
</dt>
|
|
<dd>
|
|
Tile associated with the entity, if any. Is a table { tileset = associated tileset object, quad = associated quad }.
|
|
<a href="../modules/ldtk.html#Tile.quad">quad</a> is a LÖVE Quad if LÖVE is available, otherwise a table <code>{ x, y, width, height }</code>.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>table</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Entity.fields"></a>
|
|
<strong>Entity.fields</strong>
|
|
</dt>
|
|
<dd>
|
|
Map of <a href="../modules/ldtk.html#CustomFields_objects">CustomFields</a> of the entity.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>CustomFields</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Entity:draw"></a>
|
|
<strong>Entity:draw ()</strong>
|
|
</dt>
|
|
<dd>
|
|
Called for the entity when drawing the associated entity layer (you will likely want to redefine it). </p>
|
|
|
|
<p> By default, this draws the tile associated with the entity if there is one, or a rectangle around the entity position otherwise.
|
|
|
|
<h3>Requires:</h3>
|
|
<ul>
|
|
love
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<h2 class="section-header has-description"><a name="Tileset_objects"></a>Tileset objects </h2>
|
|
|
|
<div class="section-description">
|
|
Tileset object.
|
|
Stores the image associated with the tileset; can be shared among several layers and levels.
|
|
</div>
|
|
<dl class="function">
|
|
<dt>
|
|
<a name = "Tileset.image"></a>
|
|
<strong>Tileset.image</strong>
|
|
</dt>
|
|
<dd>
|
|
The tileset LÖVE image object.
|
|
If LÖVE is not available, this is the path to the image (string).
|
|
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<h2 class="section-header has-description"><a name="Layer_objects"></a>Layer objects </h2>
|
|
|
|
<div class="section-description">
|
|
Layer object. </p>
|
|
|
|
<p> Part of a <a href="../modules/ldtk.html#Level_objects">Level</a>.
|
|
</div>
|
|
<dl class="function">
|
|
<dt>
|
|
<a name = "Layer:draw"></a>
|
|
<strong>Layer:draw ()</strong>
|
|
</dt>
|
|
<dd>
|
|
Draw the current layer.
|
|
Assumes we are currently in level coordinates (i.e. level top-left is at 0,0).
|
|
|
|
<h3>Requires:</h3>
|
|
<ul>
|
|
love
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Layer.level"></a>
|
|
<strong>Layer.level</strong>
|
|
</dt>
|
|
<dd>
|
|
<a href="../modules/ldtk.html#Level_objects">Level</a> this layer belongs to.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>Level</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Layer.identifier"></a>
|
|
<strong>Layer.identifier</strong>
|
|
</dt>
|
|
<dd>
|
|
The layer name.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>string</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Layer.type"></a>
|
|
<strong>Layer.type</strong>
|
|
</dt>
|
|
<dd>
|
|
Type of layer: IntGrid, Entities, Tiles or AutoLayer.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>string</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Layer.visible"></a>
|
|
<strong>Layer.visible</strong>
|
|
</dt>
|
|
<dd>
|
|
Whether the layer is visible or not.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>boolean</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Layer.opacity"></a>
|
|
<strong>Layer.opacity</strong>
|
|
</dt>
|
|
<dd>
|
|
The layer opacity (0-1).
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Layer.order"></a>
|
|
<strong>Layer.order</strong>
|
|
</dt>
|
|
<dd>
|
|
The layer order: smaller order means it is on top.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Layer.offsetX"></a>
|
|
<strong>Layer.offsetX</strong>
|
|
</dt>
|
|
<dd>
|
|
X position of the layer relative to the level.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Layer.offsetY"></a>
|
|
<strong>Layer.offsetY</strong>
|
|
</dt>
|
|
<dd>
|
|
Y position of the layer relative to the level.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Layer.gridSize"></a>
|
|
<strong>Layer.gridSize</strong>
|
|
</dt>
|
|
<dd>
|
|
Size of the grid on this layer.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Layer.gridWidth"></a>
|
|
<strong>Layer.gridWidth</strong>
|
|
</dt>
|
|
<dd>
|
|
Width of the layer, in grid units.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Layer.gridHeight"></a>
|
|
<strong>Layer.gridHeight</strong>
|
|
</dt>
|
|
<dd>
|
|
Height of the layer, in grid units.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Layer.entities"></a>
|
|
<strong>Layer.entities</strong>
|
|
</dt>
|
|
<dd>
|
|
<em>(Entities layer only)</em> List of <a href="../modules/ldtk.html#Entity_objects">Entity</a> in the layer.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>{Entity,...}</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Layer.tiles"></a>
|
|
<strong>Layer.tiles</strong>
|
|
</dt>
|
|
<dd>
|
|
<em>(Tiles, AutoLayer, or IntGrid with AutoLayer rules layers only)</em> List of <a href="../modules/ldtk.html#Tile_objects">Tile</a>s in the layer.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<li><code>{Tile,...}</code></li>
|
|
<li><code>nil</code> if not applicable</li>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Layer.tileset"></a>
|
|
<strong>Layer.tileset</strong>
|
|
</dt>
|
|
<dd>
|
|
<em>(Tiles, AutoLayer, or IntGrid with AutoLayer rules layers only)</em> <a href="../modules/ldtk.html#Tileset_objects">Tileset</a> object associated with the layer.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<li><code>Tileset</code></li>
|
|
<li><code>nil</code> if not applicable</li>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Layer.spritebatch"></a>
|
|
<strong>Layer.spritebatch</strong>
|
|
</dt>
|
|
<dd>
|
|
<em>(Tiles, AutoLayer, or IntGrid with AutoLayer rules layers only)</em> <a href="https://love2d.org/wiki/SpriteBatch">LÖVE SpriteBatch</a> containing the layer.
|
|
|
|
<h3>Requires:</h3>
|
|
<ul>
|
|
love
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<li><code>SpriteBatch</code></li>
|
|
<li><code>nil</code> if LÖVE not available.</li>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Layer.intTiles"></a>
|
|
<strong>Layer.intTiles</strong>
|
|
</dt>
|
|
<dd>
|
|
<em>(IntGrid without AutoLayer rules layer only)</em> list of <a href="../modules/ldtk.html#IntTile_objects">IntTile</a>s in the layer.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<li><code>{IntTile,...}</code></li>
|
|
<li><code>nil</code> if not applicable</li>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<h2 class="section-header has-description"><a name="Tile_objects"></a>Tile objects </h2>
|
|
|
|
<div class="section-description">
|
|
Tile object. </p>
|
|
|
|
<p> This represent the tiles from a Tiles, AutoLayer or IntGrid with AutoLayer rules layer.</p>
|
|
|
|
<p> Can be retrived from the <a href="../modules/ldtk.html#Layer.tiles">Layer.tiles</a> list or <code>onAddTile</code> level load callback.
|
|
</div>
|
|
<dl class="function">
|
|
<dt>
|
|
<a name = "Tile.layer"></a>
|
|
<strong>Tile.layer</strong>
|
|
</dt>
|
|
<dd>
|
|
<a href="../modules/ldtk.html#Layer_objects">Layer</a> the tile belongs to.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>Layer</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Tile.x"></a>
|
|
<strong>Tile.x</strong>
|
|
</dt>
|
|
<dd>
|
|
X position of the tile relative to the layer.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Tile.y"></a>
|
|
<strong>Tile.y</strong>
|
|
</dt>
|
|
<dd>
|
|
Y position of the tile relative to the layer.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Tile.flipX"></a>
|
|
<strong>Tile.flipX</strong>
|
|
</dt>
|
|
<dd>
|
|
Whether the tile is flipped horizontally.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>boolean</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Tile.flipY"></a>
|
|
<strong>Tile.flipY</strong>
|
|
</dt>
|
|
<dd>
|
|
Whether the tile is flipped vertically.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>boolean</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Tile.tags"></a>
|
|
<strong>Tile.tags</strong>
|
|
</dt>
|
|
<dd>
|
|
Tags associated with the tile: can be used either as a list of tags or a map of activated tags tags[name] == true.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>{"tag",["tag"]=true,...}</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Tile.data"></a>
|
|
<strong>Tile.data</strong>
|
|
</dt>
|
|
<dd>
|
|
Custom data associated with the tile, if any.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>string</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Tile.quad"></a>
|
|
<strong>Tile.quad</strong>
|
|
</dt>
|
|
<dd>
|
|
Quad associated with the tile (relative to the layer’s tileset).
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<li><code>LÖVE</code> Quad if LÖVE is available</li>
|
|
<li><code>table</code> { x, y, width, height } if LÖVE not available</li>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<h2 class="section-header has-description"><a name="IntTile_objects"></a>IntTile objects </h2>
|
|
|
|
<div class="section-description">
|
|
IntTile object. </p>
|
|
|
|
<p> This represent the tiles from a IntGrid without AutoLayer rules layer.</p>
|
|
|
|
<p> Can be retrived from the <a href="../modules/ldtk.html#Layer.intTiles">intTiles</a> list or <code>onAddIntTile</code> level load callback.
|
|
</div>
|
|
<dl class="function">
|
|
<dt>
|
|
<a name = "IntTile.layer"></a>
|
|
<strong>IntTile.layer</strong>
|
|
</dt>
|
|
<dd>
|
|
<a href="../modules/ldtk.html#Layer_objects">Layer</a> the IntTile belongs to.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>Layer</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "IntTile.x"></a>
|
|
<strong>IntTile.x</strong>
|
|
</dt>
|
|
<dd>
|
|
X position of the IntTile relative to the layer.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "IntTile.y"></a>
|
|
<strong>IntTile.y</strong>
|
|
</dt>
|
|
<dd>
|
|
Y position of the IntTile relative to the layer.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "IntTile.identifier"></a>
|
|
<strong>IntTile.identifier</strong>
|
|
</dt>
|
|
<dd>
|
|
Name of the IntTile.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>string</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "IntTile.value"></a>
|
|
<strong>IntTile.value</strong>
|
|
</dt>
|
|
<dd>
|
|
Integer value of the IntTile.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "IntTile.color"></a>
|
|
<strong>IntTile.color</strong>
|
|
</dt>
|
|
<dd>
|
|
Color of the IntTile.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>table</code> {r,g,b} with r,g,b in [0-1]
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<h2 class="section-header has-description"><a name="Level_objects"></a>Level objects </h2>
|
|
|
|
<div class="section-description">
|
|
Level object. </p>
|
|
|
|
<p> Levels are not automatically loaded in order to not waste ressources if your project is large; so before drawing or operating on a level, you will need to call its <a href="../modules/ldtk.html#Level:load">Level:load</a> method.</p>
|
|
|
|
<p> Part of a <a href="../modules/ldtk.html#Project_objects">Project</a>.
|
|
</div>
|
|
<dl class="function">
|
|
<dt>
|
|
<a name = "Level:draw"></a>
|
|
<strong>Level:draw ()</strong>
|
|
</dt>
|
|
<dd>
|
|
Draw this level.
|
|
Assumes we are currently in world coordinates (i.e. world top-left is at 0,0).
|
|
The level must be loaded.
|
|
Will draw the eventual backgrounds and all the layers in the level.
|
|
|
|
<h3>Requires:</h3>
|
|
<ul>
|
|
love
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Level:load"></a>
|
|
<strong>Level:load ([, callbacks])</strong>
|
|
</dt>
|
|
<dd>
|
|
Load the level.
|
|
Will load every layer in the level and the associated images.</p>
|
|
|
|
<p> You can optionally specify some callbacks for the loading process:</p>
|
|
|
|
<ul>
|
|
<li><code>onAddLayer(layer)</code> will be called for every new layer loaded, with the <a href="../modules/ldtk.html#Layer_objects">Layer</a> as sole argument</li>
|
|
<li><code>onAddTile(tile)</code> will be called for every new tile loaded, with the <a href="../modules/ldtk.html#Tile_objects">Tile</a> as sole argument</li>
|
|
<li><code>onAddIntTile(tile)</code> will be called for every new IntGrid tile loaded, with the <a href="../modules/ldtk.html#IntTile_objects">IntTile</a> as sole argument</li>
|
|
<li><code>onAddEntity(entity)</code> will be called for every new entity loaded, with the <a href="../modules/ldtk.html#Entity_objects">Entity</a> as sole argument</li>
|
|
</ul>
|
|
|
|
|
|
<p> These callbacks should allow you to capture all the important elements needed to use the level, so you can hopefully
|
|
integrate it into your current game engine easily.
|
|
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">callbacks</span>
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
|
|
|
|
|
(<em>optional</em>)
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Level:unload"></a>
|
|
<strong>Level:unload ([, callbacks])</strong>
|
|
</dt>
|
|
<dd>
|
|
<p>Unload the level.
|
|
Images loaded by the level will be freed on the next garbage collection cycle.</p>
|
|
|
|
<p> You can optionally specify some callbacks for the unloading process:</p>
|
|
|
|
<ul>
|
|
<li><code>onAddLayer(layer)</code> will be called for every new layer unloaded, with the <a href="../modules/ldtk.html#Layer_objects">Layer</a> as sole argument</li>
|
|
<li><code>onAddTile(tile)</code> will be called for every new tile unloaded, with the <a href="../modules/ldtk.html#Tile_objects">Tile</a> as sole argument</li>
|
|
<li><code>onAddIntTile(tile)</code> will be called for every new IntGrid tile unloaded, with the <a href="../modules/ldtk.html#IntTile_objects">IntTile</a> as sole argument</li>
|
|
<li><code>onAddEntity(entity)</code> will be called for every new entity unloaded, with the <a href="../modules/ldtk.html#Entity_objects">Entity</a> as sole argument</li>
|
|
</ul>
|
|
|
|
|
|
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">callbacks</span>
|
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
|
|
|
|
|
(<em>optional</em>)
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Level.project"></a>
|
|
<strong>Level.project</strong>
|
|
</dt>
|
|
<dd>
|
|
<a href="../modules/ldtk.html#Project_objects">Project</a> this level belongs to.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>Project</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Level.loaded"></a>
|
|
<strong>Level.loaded</strong>
|
|
</dt>
|
|
<dd>
|
|
Whether this level is currently loaded or not.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>boolean</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Level.identifier"></a>
|
|
<strong>Level.identifier</strong>
|
|
</dt>
|
|
<dd>
|
|
The level name.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>string</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Level.x"></a>
|
|
<strong>Level.x</strong>
|
|
</dt>
|
|
<dd>
|
|
The level x position.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Level.y"></a>
|
|
<strong>Level.y</strong>
|
|
</dt>
|
|
<dd>
|
|
The level y position.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Level.width"></a>
|
|
<strong>Level.width</strong>
|
|
</dt>
|
|
<dd>
|
|
The level width.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Level.height"></a>
|
|
<strong>Level.height</strong>
|
|
</dt>
|
|
<dd>
|
|
The level height.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>number</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Level.fields"></a>
|
|
<strong>Level.fields</strong>
|
|
</dt>
|
|
<dd>
|
|
Map of <a href="../modules/ldtk.html#CustomFields_objects">CustomFields</a> of the level (table).
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>CustomFields</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Level.layers"></a>
|
|
<strong>Level.layers</strong>
|
|
</dt>
|
|
<dd>
|
|
List of <a href="../modules/ldtk.html#Layer_objects">Layer</a>s in the level (table).
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>{Layer,...}</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Level.background"></a>
|
|
<strong>Level.background</strong>
|
|
</dt>
|
|
<dd>
|
|
Level background. </p>
|
|
|
|
<p> If there is a background image, <code>background.image</code> contains a table <code>{image=image, x=number, y=number, sx=number, sy=number}</code>
|
|
where <a href="../modules/ldtk.html#Tileset.image">image</a> is the LÖVE image (or image filepath if LÖVE not available) <a href="../modules/ldtk.html#Tile.x">x</a> and <a href="../modules/ldtk.html#Level.y">y</a> are the top-left position,
|
|
and <a href="../modules/ldtk.html#Entity.sx">sx</a> and <a href="../modules/ldtk.html#Entity.sy">sy</a> the horizontal and vertical scale factors.
|
|
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
<h3>Fields:</h3>
|
|
<ul>
|
|
<li><span class="parameter">color</span>
|
|
backrgound color {r,g,b} with r,g,b in [0-1]
|
|
</li>
|
|
<li><span class="parameter">image</span>
|
|
backrgound image information, if any
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<h2 class="section-header has-description"><a name="Project_objects"></a>Project objects </h2>
|
|
|
|
<div class="section-description">
|
|
Project object. </p>
|
|
|
|
<p> Returned by <a href="../modules/ldtk.html#LDtk">LDtk</a>.
|
|
</div>
|
|
<dl class="function">
|
|
<dt>
|
|
<a name = "Project.levels"></a>
|
|
<strong>Project.levels</strong>
|
|
</dt>
|
|
<dd>
|
|
List of <a href="../modules/ldtk.html#Level_objects">Level</a>s in this project.
|
|
|
|
</ul>
|
|
<h3>Type:</h3>
|
|
<ul>
|
|
<code>{Level,...}</code>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<h2 class="section-header has-description"><a name="CustomFields_objects"></a>CustomFields objects </h2>
|
|
|
|
<div class="section-description">
|
|
Custom fields: map of each field name to its value. </p>
|
|
|
|
<p> LDtk allows to defined custom fields in some places (<a href="../modules/ldtk.html#Entity.fields">Entity.fields</a>, <a href="../modules/ldtk.html#Level.fields">Level.fields</a>). This library allows you to access them in a table that
|
|
map each field name to its value <code>{["fieldName"]=value,…}</code>.
|
|
</div>
|
|
<dl class="function">
|
|
</dl>
|
|
<h3 class="doc-title"><a name = "CustomFields.conversion"></a>Type conversion.</h3>
|
|
<div class="doc-description">
|
|
<p> Here is how the values are converted to Lua values:</p>
|
|
|
|
<ul>
|
|
<li>Integers, Floats are converted into a Lua number.</li>
|
|
<li>Booleans are converted into a Lua boolean.</li>
|
|
<li>Strings, Multilines are converted in a Lua string.</li>
|
|
<li>Enum are converted into a Lua string giving the currently selected enum value.</li>
|
|
<li>Filepath are converted into a Lua string giving the file path.</li>
|
|
<li>Arrays are converted into a Lua table with the elements in it as a list.</li>
|
|
<li>Points are converted into a Lua table with the fields <a href="../modules/ldtk.html#Tile.x">x</a> and <a href="../modules/ldtk.html#Level.y">y</a>: <code>{ x=number, y=number }</code>.</li>
|
|
<li>Colors are converted into a Lua table with the red, green and blue components in [0-1] as a list: <code>{r,g,b}</code>.</li>
|
|
</ul>
|
|
|
|
|
|
</div>
|
|
<dl class="function">
|
|
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
|
|
|
|
</div> <!-- id="content" -->
|
|
</div> <!-- id="main" -->
|
|
<div id="about">
|
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
|
<i style="float:right;">Last updated 2021-12-26 18:43:30 </i>
|
|
</div> <!-- id="about" -->
|
|
</div> <!-- id="container" -->
|
|
</body>
|
|
</html>
|