OttoRobba Posted January 7, 2015 Share Posted January 7, 2015 I was fiddling with the Tiled plugin, trying to get it to work with object layers. I've managed to get the plugin not to crash with non-data layers and it properly finds the name of the object, along with its properties.My question is, how can I create an entity from it? For example: I created a class called "Troll" in my game. I created an object named "Troll" in Tiled.My naïve approach was callingnew game[layer.objects[num].name]()but that, clearly, didn't work. I've attached a sample project. The code that handles object initialization starts at line 84.test-tiles.zip Quote Link to comment Share on other sites More sharing options...
enpu Posted January 7, 2015 Share Posted January 7, 2015 Hi! It seems that Troll class gets created, but you are adding it's sprite to stage, and after that you are adding your tilemap into stage.This way Troll gets below your tilemap, so that's why you don't see it. One way would be to make containers for your map and trolls etc. OttoRobba and WombatTurkey 2 Quote Link to comment Share on other sites More sharing options...
OttoRobba Posted January 7, 2015 Author Share Posted January 7, 2015 Hmmmm I see now, thanks Enpu If I manage to get the changes to a decent state, I'll make a pull request on GitHub later Quote Link to comment Share on other sites More sharing options...
enpu Posted January 7, 2015 Share Posted January 7, 2015 Thanks! Quote Link to comment Share on other sites More sharing options...
OttoRobba Posted January 7, 2015 Author Share Posted January 7, 2015 Submitted a pull request Really glad with it, thanks for the awesome assistance Enpu 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.