I'm trying to modify the test-tiles.py example to be non-scrolling.
However, I can't get the map to actually show. I got a start with the
comments at the beginning of the file, and have a setup like this:

r = tiles.load('example.xml')
scene = Scene(r['map0']
director.run(scene)

When run, all I see is a black screen. I've also tried making a
RectMapLayer, but I'm unsure how to set one up, specifically what the
id and cells parameters should be. I believe the id is the Map ID from
the XML file, but I don't know what the other one should be. I have
something like this:

r = tiles.load('example.xml')
bgLayer = RectMapLayer('map0', 128, 128, r)

When run, I get a crash that says "Object of type Resource has no len
()"

What is the proper way to set up a non-scrolling map?

On Dec 7, 4:17 pm, "Richard Jones" <[email protected]> wrote:
> On Mon, Dec 8, 2008 at 9:49 AM, s73v3r <[email protected]> wrote:
> > I'm getting started with Cocos2D, and I'm working on generating a map.
> > I can get the map set up in XML, and I was wondering if there was an
> > attribute to set a path or border on the map where my character
> > sprites would be limited to going. Like, if I were to have a tile for
> > grass, and one for dirt, set it up so the characters could only go on
> > the dirt, and stay off the grass. If not, what is the preferred method
> > for doing this?
>
> You can achieve this by setting a property on the tile (or the map
> cell, but it's more consistent to do it on the tile) in the XML file
> which says the tile is impassable. For example your XML could have:
>
> <?xml version="1.0"?>
> <resource>
>  <tileset>
>   <tile id="ground-cobble">
>     <image ref="i-ground-cobble" /></tile>
>   <tile id="water">
>     <property name="impassable" type="bool" value="True" />
>     <image ref="i-water" /></tile>
>  </tileset>
> </resource>
>
> Then you may:
>
>    ground_map = cocos.tiles.load('map_filename.xml')['map_id']
>    current_cell = (1, 1)
>    if ground_map.get('impassable'):
>       # block movement
>    else:
>       # allow movement
>
> I've added some more docs to the tiles module to explain this better.
>
>       Richard
--~--~---------~--~----~------------~-------~--~----~
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=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to