Swift parse problems

I’m new to swift and trying to create some tiled levels for a 2D side scroller game. I can’t find any info online about parsing through images. I found it for rectangular shapes, but anything else I try to look for is in ObjC or some other language. Anyone know of tutorials for tiled specifically for swift?

If I understand you correctly, you want to build a game for ios?
You might want to check out http://koboldkit.com/ then (Or in general https://github.com/bjorn/tiled/wiki/Support-for-TMX-maps). They seem to have some tutorials here too: http://wiki.koboldkit.com/display/KKD/Getting+Started.


@Ablu The websites you gave are not in Swift. I have no idea how to parse the TMX files with Swift. Can you please give some websites that actually explain how to parse the files or just explain it.

@Ablu thanks for the reply. I researched koboldkit before posting here but it seems I have the same issue as @JJJPPP since they haven’t switched to swift yet :-/.

https://github.com/bjorn/tiled/wiki/TMX-Map-Format explains the map format. You can read it using your xml parser library of choice.

I unfortunatly have no experience with swift. So I fear I cannot help with this.


EDIT: Sorry. I posted the wrong link. Updated!

Actually, I used JSTileMap to parse the TMX files and actually got it to work. @vhristov Here is the link I used to find how to do it: https://github.com/slycrel/JSTileMap and use http://stackoverflow.com/questions/25995131/how-to-use-jstilemap-in-swift to help you understand what to do.

thanks! this is definitely going to help. I have some parse code from tutorials I took, but having lots of issues with the correct Y coordinates translating over. Always need to adjust depending not he layer object.

@vhristov You should something about being able to parse rectangular shapes in Swift. I am trying to set a spawn point in the map, and I don’t really know how to approach it. Do you know anything about this?

TilemapKit will take the burden of parsing TMX files from you. It works with Swift.

I plan on adding all the annoying bits as well, such as spawning nodes (or custom classes) for any given object, and using different nodes for a given tile GID so you could have tiles that will actually be particle emitters or using custom shaders at runtime.