On Thu, Nov 19, 2009 at 8:40 AM, karan <[email protected]> wrote:

>
>
> On Nov 18, 8:58 pm, claudio canepa <[email protected]> wrote:
> > hi karam.
> > I'm an interested observer here, not a cocograph or cocos dev.
> > Can you upload a .zip or .tgz with the additional files needed to run
> your
> > sample code ?
> > Also pointing what cocograph revision you are using ? ( I think cocograph
> > upgraded between your first post and the bump, but probably only to
> > accommodate changes in kytten)
> >
> > --
> > claudio
>
> Ok, I've uploaded the zip file. The cocograph I'm using is the one
> that is available in the svn repository of cocograph. I don't really
> know which version it is.
> Thanks!
>
>
>
Ok, I think I know what was the problem.
Lets see what I do:

moved hell.xml into dungeon subdir
( so doing chdir in the script we have access to all resources, maybe theres
another way to tell tiles.load where to look, but I dont know)

changed first line in hell.xml from
<resource><requires file="dungeon/level-dungeon-1.xml" />

to

<resource><requires file="tiles.xml" />

( with the prev move and the changedir we dont need to mention subdir
dungeon, also it has sense to point to a tiles mapping 'tiles.xml' and not
another map
'level-dungeon-1.xml' )

taken tiles_tiles.py from cocos repo, r879, and modified to load the karan
map ( hell.xml ),
one line added, one line modified, map loads and show ( use arrows to go
right and see tiles)

going back to karan test code 2 ( as seen in the post ), and looking at the
cocos file
tiles.py, I think theres some confusion there:
the return value for tiles.load includes the appropriate RectMapLayer
instance, as adding some prints in code2 shows:

os.chdir('dungeon')
map_ = tiles.load('hell.xml')
print map_ # -> <cocos.tiles.Resource object at 0x031A69F0>
print map_['level1'] # -> <cocos.tiles.RectMapLayer object at 0x032421F0>

so, no need to instantiate another RectMapLayer.

I guess you expected other return value from tiles.load
Im not familiarized with that code, but the docstring at the beginning in
cocos/tiles.py seems to picture some common usage.

uploaded the relevant code at
http://groups.google.com/group/cocos-discuss/web/karam_map.zip
It dont includes cocos, but runs both with cocos svn r879 or the cocos that
you included.

Probably you will be safe modifying in little steps test_tiles.py to make it
do what you want.

--
claxo

--

You received this message because you are subscribed to the Google Groups 
"cocos2d discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cocos-discuss?hl=.


Reply via email to