pub struct Level {Show 21 fields
pub bg_color: String,
pub bg_pos: Option<LevelBackgroundPosition>,
pub neighbours: Vec<NeighbourLevel>,
pub smart_color: String,
pub level_bg_color: Option<String>,
pub bg_pivot_x: f64,
pub bg_pivot_y: f64,
pub level_bg_pos: Option<BgPos>,
pub bg_rel_path: Option<String>,
pub external_rel_path: Option<String>,
pub field_instances: Vec<FieldInstance>,
pub identifier: String,
pub iid: String,
pub layer_instances: Option<Vec<LayerInstance>>,
pub px_hei: i64,
pub px_wid: i64,
pub uid: i64,
pub use_auto_identifier: bool,
pub world_depth: i64,
pub world_x: i64,
pub world_y: i64,
}
Expand description
This section contains all the level data. It can be found in 2 distinct forms, depending
on Project current settings: - If “Separate level files” is disabled (default):
full level data is embedded inside the main Project JSON file, - If “Separate level
files” is enabled: level data is stored in separate standalone .ldtkl
files (one
per level). In this case, the main Project JSON file will still contain most level data,
except heavy sections, like the layerInstances
array (which will be null). The
externalRelPath
string points to the ldtkl
file. A ldtkl
file is just a JSON file
containing exactly what is described below.
Fields§
§bg_color: String
Background color of the level (same as bgColor
, except the default value is
automatically used here if its value is null
)
bg_pos: Option<LevelBackgroundPosition>
Position informations of the background image, if there is one.
neighbours: Vec<NeighbourLevel>
An array listing all other levels touching this one on the world map. Since 1.4.0, this
includes levels that overlap in the same world layer, or in nearby world layers.
Only relevant for world layouts where level spatial positioning is manual (ie. GridVania,
Free). For Horizontal and Vertical layouts, this array is always empty.
smart_color: String
The “guessed” color for this level in the editor, decided using either the background color or an existing custom field.
level_bg_color: Option<String>
Background color of the level. If null
, the project defaultLevelBgColor
should be
used.
bg_pivot_x: f64
Background image X pivot (0-1)
bg_pivot_y: f64
Background image Y pivot (0-1)
level_bg_pos: Option<BgPos>
An enum defining the way the background image (if any) is positioned on the level. See
__bgPos
for resulting position info. Possible values: <null
>, Unscaled
,
Contain
, Cover
, CoverDirty
, Repeat
bg_rel_path: Option<String>
The optional relative path to the level background image.
external_rel_path: Option<String>
This value is not null if the project option “Save levels separately” is enabled. In this case, this relative path points to the level Json file.
field_instances: Vec<FieldInstance>
An array containing this level custom field values.
identifier: String
User defined unique identifier
iid: String
Unique instance identifier
layer_instances: Option<Vec<LayerInstance>>
An array containing all Layer instances. IMPORTANT: if the project option “Save
levels separately” is enabled, this field will be null
.
This array is sorted
in display order: the 1st layer is the top-most and the last is behind.
px_hei: i64
Height of the level in pixels
px_wid: i64
Width of the level in pixels
uid: i64
Unique Int identifier
use_auto_identifier: bool
If TRUE, the level identifier will always automatically use the naming pattern as defined
in Project.levelNamePattern
. Becomes FALSE if the identifier is manually modified by
user.
world_depth: i64
Index that represents the “depth” of the level in the world. Default is 0, greater means
“above”, lower means “below”.
This value is mostly used for display only and is
intended to make stacking of levels easier to manage.
world_x: i64
World X coordinate in pixels.
Only relevant for world layouts where level spatial
positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, the
value is always -1 here.
world_y: i64
World Y coordinate in pixels.
Only relevant for world layouts where level spatial
positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, the
value is always -1 here.