I am aware that this is a forum dedicated to the discussion of cocos-x and not cocos-python, but the cocos-python community on Google groups is virtually “dead”.
I’ve Googled my error to the best of my abilities, but there are no definative answers to my problem.
whilst the question might be out of place, your reply isn’t a valid answer. He wasn’t asking for engine recomendations, he was asking a question about the TMX loader in Cocos2d original
lol thanks for your reply 1 year later, but you don’t provide the right answer… At least, its possible that my reply had helped some people who clicked the link, so I think your reply is even worst than mine
Actually, panor, I found this while searching for a solution to a problem I’m having (the same problem Pythong is having), and your response was so frustratingly useless I decided to make an account just to point that out.
As for the question itself, I actually found a solution elsewhere (again, no thanks to panor >.>). You’re on the right track with your work around. It seems cocos.tiles.load(filename) returns a cocos.tiles.Resource object, which functions a bit like a dictionary- that ‘layer1’ you used would be the key, while the value is the map layer it yields. You can use the find(cls) method of the cocos.tiles.Resource object to find all instances of cocos.tiles RectMapLayer like so:
maps = map.find(cocos.tiles.RectMapLayer)
This will return a generator which returns a tuple of key/value pairs, with the value being the second item of the tuple. You can use this generator in a for loop to iteratively add all layers in your map.
for i in maps:
scene.add(i[1])
i.set_view(*x, y, w, h, viewport_x=0, viewport_y=0*)
#You'll recognize the above method from the part of the tutorial you linked.