levigilbert / godot-ldtk-import Goto Github PK
View Code? Open in Web Editor NEWBasic GDscript for importing LDtk files into the Godot game engine.
License: MIT License
Basic GDscript for importing LDtk files into the Godot game engine.
License: MIT License
I imported sample LDTK project and colliders located in the same row are combined.
I expected colliders of type "ladder" to be separate from "dirt" colliders - so I can apply some game logic to ladders right away.
I'm not entirely sure that it is importer combines the colliders - but I can't find an option to "uncheck" the combining in the LDTK editor.
Error given is in Godot 3.5.stable:
res://addons/LDtk-Importer/LDtk.gd:189 - Invalid get index 'autoTilesetDefUid' (on base: 'Dictionary').
I have all the tilemaps set and the IntGrid map name is: Collisions
even in the test-example provided in the repo if I draw a new map in GridVania mode the example fails
I created a layer named "Collisions", and put down tiles in it, but I do not see any collision shapes imported in the game
(Clicking "Show collisions" on the TileMap doesn't reveal anything)
Hi lgilbert,
I couldn't track down your contact info so this issue will have to do :)
Currently there are three Godot LDtk importers:
When I first checked out your importer, it was not as far along, and then I made the mistake of not checking back when embarking on reworking Josh's importer for my own holiday game making. I suggested to Josh that we all work together here:
JoshLee0915/GodotLDtkImporter#18
I believe our entity handling is more sophisticated (we can instance user scenes), but your importer has a bunch of better aspects like proper unit testing. If you want to chat realtime, I'm on the LDtk Discord, and my email is just my last name at gmail.
Cheers,
Keir
Godot couldn't load the TileSet texture. The bug turned out to be that the plugin specified the wrong path to the image.
Here's my file structure:
res://
maps/
test.ldtk
tilesets/
dungeon.png
In the test.ldtk
file the relative path to dungeon.png
was specified as tilesets/dungeon.png
.
On the line 123 in the LDtk.gd
Godot returns an error file 'res://tilesets/dungeon.png' not found.
#create new tileset from tileset_data.
func new_tileset(tileset_data):
var tileset = TileSet.new()
var texture_filepath = 'res://' + tileset_data.relPath
var texture = load(texture_filepath)
I fixed this bug by changing the value of the texture_filepath
to:
var texture_filepath = map_data.base_dir + '/' + tileset_data.relPath
map_data.base_dir
appears in the function load_LDtk_file
:
#get LDtk file as JSON.
func load_LDtk_file(filepath):
var json_file = File.new()
json_file.open(filepath, File.READ)
var json = JSON.parse(json_file.get_as_text()).result
json_file.close()
json['base_dir'] = filepath.get_base_dir()
return json
After that, everything worked.
P.S.
sorry for my broken english
How do you plan to handle the update to 4?
Not at all?
Maybe?
Soon?
Dont know yet?
The collisions preset does nothing. I have the preset enabled on the import tab, and in LDtk I've created a layer named "Collisions," but no colliders are generated when reimporting .ldtk file.
Currently, entities without the NodeType
field will be skipped for import.
I think this behavior needs some more discussion.
I would prefer to import it as a Node2d node and import all fields as metadata to be used by post-processing scripts.
Also currently, only custom fields are imported. I think it might be useful to import the non-custom fields (__tags etc.) together.
I will open a proposed PR later.
How to use it?
Unsure if limitation or user error, but marking an area of tiles in either an Intgrid or Autotile layer fails to import appropriately into Godot.
It behaves appropriately in editor but doesn't seem to in the generated scene.
Using Godot 3.5 Stable with LDtk 1.1.3-64bit
Minimal recreation: The 'AutoLayers 2 stamps' sample map in LDtk uses a 2x2 rectangle of tiles rule in its Intgrid layer.
godot 3.3
ldtk 0.9.3 and ldtk 0.8.x
Following official sample from ldtk could not be imported correctly in godot.
LDtk version: 1.1.3
Godot version 3.5.rc5 (also happens in 3.4.4 stable)
Hi, I have found some issue setting a level with a single tile width at the right of the level. This level for example:
If you import it, you will get these collisions:
I have added a few prints to try to understand what is happening and I have found that looks like initial_position is not being calculated correctly for the case where there's a single tile:
If I add one more tile the issue is gone:
The issue happens as well if there isn't any tile at the beginning of the row:
Since we may place our characters on Entities layers in ldtk, it's reasonable to expect them could follow the y-sort rule when in top-down scene.
Maybe we could add this options to import tab?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.