LDtkMonogame.ContentPipeline
1.6.0
dotnet add package LDtkMonogame.ContentPipeline --version 1.6.0
NuGet\Install-Package LDtkMonogame.ContentPipeline -Version 1.6.0
<PackageReference Include="LDtkMonogame.ContentPipeline" Version="1.6.0" />
paket add LDtkMonogame.ContentPipeline --version 1.6.0
#r "nuget: LDtkMonogame.ContentPipeline, 1.6.0"
// Install LDtkMonogame.ContentPipeline as a Cake Addin #addin nuget:?package=LDtkMonogame.ContentPipeline&version=1.6.0 // Install LDtkMonogame.ContentPipeline as a Cake Tool #tool nuget:?package=LDtkMonogame.ContentPipeline&version=1.6.0
<p align="center"> <img src="https://raw.githubusercontent.com/IrishBruse/LDtkMonogame/main/Icon.png" height="128px"/> </p>
<p align="center"> <a href="https://ldtk.io/go/discord"><img src="https://img.shields.io/badge/Discord-LDtk-yellow" alt="Discord Link"></a> <a href="https://github.com/deepnight/ldtk"><img src="https://img.shields.io/badge/LDtk-1.5.3-yellow" alt=""></a> </p>
LDtkMonogame is an level importer for the LDtk level editor
Getting Started
The easiest way to start using LDtkMonogame is to import it into the project using NuGet package.
Make sure to import the namespace at the top
using LDtk;
// Optional
using LDtk.Renderer;
LDtk.Renderer is a premade renderer for the levels, you can create your own if you have more specific needs ExampleRenderer.cs is an example of how to make one. Or you can inherit it and extend it.
To get started loading ldtk files load the file in Initialize
.
LDtkFile file = LDtkFile.FromFile("World", Content);
LDtkFile file = LDtkFile.FromFile("Data/World.ldtk");
Then load the world right after for now ldtk only supports one file but make sure to enable the multiworlds flag in the project settings under advanced.
LDtkWorld world = file.LoadWorld(Worlds.World.Iid);
The Worlds.World.Iid
is generated from the ldtkgen tool and is recommended that you use it for static typing of entities and levels.
It is a class within in a class that represents the world name and the levels name and holds the iid you can use to load that specific level.
Create the renderer in Initialize
.
ExampleRenderer renderer = new ExampleRenderer(spriteBatch, Content);
ExampleRenderer renderer = new ExampleRenderer(spriteBatch);
Prerender Levels
foreach (LDtkLevel level in world.Levels)
{
renderer.PrerenderLevel(level);
}
Now to render the level and entities we loaded in Draw
GraphicsDevice.Clear(world.BgColor);
spriteBatch.Begin(samplerState: SamplerState.PointClamp);
{
foreach (LDtkLevel level in world.Levels)
{
renderer.RenderPrerenderedLevel(level);
}
}
spriteBatch.End();
Showcase
Unnamed
by Fypur
Example Game
by IrishBruse
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- LDtkMonogame (>= 1.6.0)
- MonoGame.Framework.Content.Pipeline (>= 3.8.2.1105)
- MonoGame.Framework.DesktopGL (>= 3.8.2.1105)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.6.0 | 158 | 10/14/2024 |
1.6.0-beta | 81 | 10/9/2024 |
1.5.0 | 131 | 9/26/2024 |
1.5.0-beta | 82 | 9/20/2024 |
1.4.0 | 120 | 9/9/2024 |
1.3.3 | 160 | 7/7/2024 |
1.3.2 | 153 | 5/28/2024 |
1.3.1 | 111 | 5/26/2024 |
1.3.0 | 120 | 5/24/2024 |
1.2.0 | 246 | 1/25/2024 |
1.1.2 | 281 | 9/8/2023 |
1.1.0 | 196 | 6/8/2023 |
1.0.1 | 413 | 1/15/2023 |
1.0.0 | 317 | 1/3/2023 |
0.7.0 | 495 | 7/26/2022 |
0.6.5 | 475 | 7/20/2022 |
0.6.4 | 471 | 6/14/2022 |
0.6.3 | 462 | 6/14/2022 |
0.6.2 | 495 | 5/10/2022 |
0.6.1 | 491 | 5/10/2022 |
0.6.0 | 463 | 5/10/2022 |
0.5.0 | 482 | 5/9/2022 |
0.4.1 | 333 | 12/24/2021 |
0.4.0 | 295 | 12/23/2021 |