ipop Posted July 28, 2013 Share Posted July 28, 2013 Has anyone looked into or have example code of using tiled editor to export json and display in pixi? Quote Link to comment Share on other sites More sharing options...
xerver Posted July 29, 2013 Share Posted July 29, 2013 My grapefruit game engine uses PIXI as the renderer, and supports Tiled Editor maps. Repo:https://github.com/grapefruitjs/grapefruit Tiled Code:https://github.com/grapefruitjs/grapefruit/tree/master/src/map/tiled Quote Link to comment Share on other sites More sharing options...
ipop Posted July 31, 2013 Author Share Posted July 31, 2013 Wow! goes a bit above my head .. been lokoing at the json export from tiled, which looks pretty simple. Im just learning JS so im confused as to what the pixi loader/parser does with any json it loads .. as it seemingly parses the data when it loads? how do you access the object(s)? Quote Link to comment Share on other sites More sharing options...
xerver Posted July 31, 2013 Share Posted July 31, 2013 It loads the json via ajax, which will return the content as a string. Then you parse the json into an object and use it. For example://pretend this is loaded via ajaxvar data = '{ "my": "json data", "someArray": [1,2,3,4,5] }';//now parse the string JSON into an objectvar obj = JSON.parse(data);//use the objectconsole.log(obj.my); //outputs "json data" Quote Link to comment Share on other sites More sharing options...
ipop Posted August 1, 2013 Author Share Posted August 1, 2013 It loads the json via ajax, which will return the content as a string. Then you parse the json into an object and use it. For example://pretend this is loaded via ajaxvar data = '{ "my": "json data", "someArray": [1,2,3,4,5] }';//now parse the string JSON into an objectvar obj = JSON.parse(data);//use the objectconsole.log(obj.my); //outputs "json data"Many thanks .. im making a lot of mistakes with my code (but enjoying the challenge) .. you think people would mind me throwing stuff up here so i can learn ... maybe i could write it up for you in return as some noob tutorials? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.