Hi, Bastien

I don't see what is exactly your intent, it can be one of

1. add static decoration (sprites that don't move in world coords) that
maybe don't align to a grid using a tmx layer as source info

2. add actors that can roam the world, using starting position and other
info loaded from a tmx layer info to build the sprites

3. add 'special' tiles that can't be loaded directly from a tmx layer (why
can't be loaded ?)

Maybe others. Can you clarify ?






On Tue, Jun 27, 2017 at 2:32 PM, Bastien Sevajol <[email protected]>
wrote:

> Hello,
>
> I'm trying to use cocos.tiles.RectMapLayer in this context:
>
>
>    - A cocos.scene.Scene construct with:
>       - A cocos.layer.scrolling.ScrollableLayer containing:
>          1. A background image: cocos.sprite.Sprite
>          2. A "ground" layer: cocos.tiles.RectMapLayer (built from
>          cocos.tiles.load and tmx file)
>          3. A "subjects" layer: cocos.tiles.RectMapLayer (manually built)
>          4. A "top" layer: cocos.tiles.RectMapLayer (built from
>          cocos.tiles.load and tmx file)
>
> The "subjects" layer is built manually:
>
>
>     def get_subjects_layer(self) -> cocos.tiles.RectMapLayer:
>         # TODO: hardcoded values: use TMX infos
>         cells = self.generate_subjects_cells(width=70, height=40,
> tile_width=8, tile_height=8)
>         return cocos.tiles.RectMapLayer(
>             id='subject',
>             tw=8,  # hardcoded values: use TMX infos
>             th=8,  # hardcoded values: use TMX infos
>             cells=cells,
>         )
>
>     def generate_subjects_cells(
>         self,
>         width: int,
>         height: int,
>         tile_width: int,
>         tile_height: int,
>     ) -> typing.List[typing.List[cocos.tiles.RectCell]]:
>         cells = [[None] * height for x in range(width)]  # type:
> typing.List[typing.List[cocos.tiles.RectCell]]
>         for n in range(width * height):
>             i = n % width
>             j = height - (n // width + 1)
>             # TODO: Give here the tile
>             cells[i][j] = cocos.tiles.RectCell(i, j, tile_width,
> tile_height, properties={}, tile=None)
>         return cells
>
> My goal is to add some sprites to "subjects" layer. But, i can see what
> cocos.tiles.RectMapLayer.cells, so cocos.tiles.Cell require a
> cocos.tiles.Tile. How can i use my sprites with a cocos.tiles.RectMapLayer ?
>
>
> Regards,
>
> Bux.
>
> --
> You received this message because you are subscribed to the Google Groups
> "cocos2d discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/cocos-discuss.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"cocos2d discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/cocos-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to