Re: Loading TMX object layer?

86 views
Skip to first unread message

claudio canepa

unread,
Dec 19, 2012, 4:32:09 PM12/19/12
to cocos-...@googlegroups.com


On Wed, Dec 19, 2012 at 6:10 PM, Art Aquino <art...@gmail.com> wrote:
Hello all. I am attempting to load an object layer from a TMX file using the same method as a regular layer and this is not working. I looked through the code examples and cannot find anything that shows how to do this. Can anyone explain? Thanks. 
  


Look at the sample test_tmx.py.
It loads a TMX map named road-map.tmx

Replace 'road-map.tmz' with your's map name.

See if it runs, else try to fix.

If you hit a brickwall, post asking for help, with code.

Note: test_tmx.py and its resources comes in the cocos source release, also in a docs and samples .zip and also in a svn checkout.

If you installed from pip you will need to get one of this sources and look into the test directory.

Downloads are available from

hth

 

Art Aquino

unread,
Dec 19, 2012, 7:53:25 PM12/19/12
to cocos-...@googlegroups.com
Thanks for the reply Claudio. I have looked at that test files and they were a great help. That is how I was able to load a tile layer. My problem is loading an object layer. For example:

self.resource = cocos.tiles.load('map.tmx')
self.map = self.resource.get_resource('Tile Layer 1')
self.obj = self.resource.get_resource('Obj Layer 1')

When I try to load an object layer using the method above, I get a key error. I can create multiple tile layers and load them fine, but I cannot load object layers this way and could not find a method in the cocos2D API that would do that.  

claudio canepa

unread,
Dec 19, 2012, 11:15:17 PM12/19/12
to cocos-...@googlegroups.com
  --


I'm not familiarized with the TMX format, nor the cocos support for it.
Looking at issue 182
I suspect what you want is not implemented.
Maybe Richard can confirm or correct if I'm wrong.

As an alternative, you can look at this post
( Full TMX map format support , proof of concept by Hogne )


 

Art Aquino

unread,
Dec 20, 2012, 8:41:48 AM12/20/12
to cocos-...@googlegroups.com
Thanks for the assistance. I will look at those links and figure out a solution.
Reply all
Reply to author
Forward
0 new messages