Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] - Read TMX. (Tiled) File

Author
Message
Derekioh
15
Years of Service
User Offline
Joined: 1st Feb 2009
Location:
Posted: 19th Jun 2012 06:50 Edited at: 21st Jun 2012 20:20
Thanks to Phaelax's awesome XML parser,http://forum.thegamecreators.com/?m=forum_view&t=179871&b=6 I have developed a nice reader for all your 2D .TMX file needs

First you need to change your settings in Tiled: Edit->Preferences and change it to CSV.




This code will read the data and store it in appropriate variables that you can use in your program. the wait key was just for running in a program separately if you wanna see it in action.

EDIT: oh and if you are having problems with the image variables, the way the xmlparser works it doesn't recognize it unless you add </image> before </tileset> and that should fix it. I'll try to work on fixing that problem.

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 20th Jun 2012 04:09
Cool, but should've waited to post this until you had the code.

"You're not going crazy. You're going sane in a crazy world!" ~Tick
Derekioh
15
Years of Service
User Offline
Joined: 1st Feb 2009
Location:
Posted: 20th Jun 2012 20:36
you are absolutely right, I thought it was fine and i screwed up. Its up now though and I will be more careful next time

Login to post a reply

Server time is: 2024-04-19 04:49:43
Your offset time is: 2024-04-19 04:49:43