RectMapLayer example?

56 views
Skip to first unread message

Mathias Roth

unread,
Jun 8, 2009, 2:18:28 PM6/8/09
to cocos-...@googlegroups.com
Hey, cocos2d seems quite promising, but the doc's are a bit poor :<...
Is there any example of RectMapLayer usage available, if possible with
explanation?

Lucio Torre

unread,
Jun 8, 2009, 3:32:13 PM6/8/09
to cocos-...@googlegroups.com

Mathias Roth

unread,
Jun 9, 2009, 8:05:30 AM6/9/09
to cocos-...@googlegroups.com
Hm, I still don't quite get it, could you whip up a quick example
where you can move one sprite from tile to tile? (Similar to the
fights in Heroes of Might and Magic 3
(http://img.photobucket.com/albums/v607/tigris/entertopia.gif) , but
with rect tiles)

Thanks,
mots

Lucio Torre

unread,
Jun 9, 2009, 8:14:27 AM6/9/09
to cocos-...@googlegroups.com
On Tue, Jun 9, 2009 at 9:05 AM, Mathias Roth<simpl...@gmail.com> wrote:
>
> Hm, I still don't quite get it, could you whip up a quick example
> where you can move one sprite from tile to tile? (Similar to the
> fights in Heroes of Might and Magic 3
> (http://img.photobucket.com/albums/v607/tigris/entertopia.gif) , but
> with rect tiles)
>

Take the test_tiles.py example, and change the movement of the car so
it just moves from tile center to tile center. This has nothing to do
with tile maps.

Lucio.

Mathias Roth

unread,
Jun 9, 2009, 10:29:09 AM6/9/09
to cocos-...@googlegroups.com
Hm, I'm still a bit confused... Let's say I want to randomly generate
my map and not load anything from xml... How would I construct a layer
(and which one do I need) and make let's say the cell at the position
[5][3] have a certain tile as background?

Sorry if I'm talking nonsense, but I'm new to cocos and the tutorial
doesn't really cover this :<

Lucio Torre

unread,
Jun 9, 2009, 11:54:34 AM6/9/09
to cocos-...@googlegroups.com
On Tue, Jun 9, 2009 at 11:29 AM, Mathias Roth<simpl...@gmail.com> wrote:
>
> Hm, I'm still a bit confused... Let's say I want to randomly generate
> my map and not load anything from xml... How would I construct a layer
> (and which one do I need) and make let's say the cell at the position
> [5][3] have a certain tile as background?
>

Im not sure how to do that. Maybe generate a random xml? :)

richard?

Lucio.

devon

unread,
Jun 10, 2009, 11:44:14 AM6/10/09
to cocos2d discuss
can't you pass in a 2d list/array of cell objects to the constructor
of the rect map?
and access them like my_map.cells[i][j] later?

I haven't used tile maps but it looks like it to me:
__init__(self, id, tw, th, cells, origin=None)

Devon

On Jun 9, 10:54 am, Lucio Torre <lucio.to...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages