just to be more specific, if trying to use two layers, one with the image
unmodified and another with "empty" cells
  - as Daniel said, the Scene would be composed as
      scene
        scrolling manager
             Scrollable layer (z=0)
                Sprite with the image (*)
            Scrollable layer (z=1)
                hexmap filled with "empty cells"

 - "empty cells" *must*
        + have a tile to change colors (else no action or exception)
        + the tile *image* should be a solid color (if you choose white
then you can use multiple highlight colors,  transparent will not work or
will produce unexpected results because color and opacity multiplies the
pixel values)
        + the tile image needs to have a specific relation between width,
height and hexagon side; for testing purposes use a copy of the tile in the
cocos example, painting it to solid white in a graphic editor
      +  transparency in any (highlighted \ non-highlighted) state should
be low to allow view the image behind
      + each state has it own (color, opacity) values; opacity==0 is
acceptable for one of the states

- this implementation  will look as is they were tinted haze between the
image and the eye, with possibly one state having no haze (opacity=0). It
may or may not work visually for the effect you wanted to achieve,

(*) if your texture is smaller than the max size allowed for the hardware:
for modern hardware 4K x 4K, older 2K x 2K or 1K x 1K. If image bigger,
then you can partition into a rectangular tileset and show as a rect map



On Sat, Sep 10, 2016 at 6:30 AM, Daniel Gillet <[email protected]>
wrote:

>
>
> Le vendredi 9 septembre 2016 19:00:27 UTC+2, Robert Haddon a écrit :
>>
>> I'm wondering if this is problem. I'm adding a layer as a child to
>> another layer.
>> class Hexagons(cocos.layer.ScrollableLayer):
>>     is_event_handler = False     #: enable director.window events
>>
>>     def __init__(self):
>>         super().__init__()
>>         hex_resource = cocos.tiles.load('large_hex.tmx')
>>         hex_layer = hex_resource['hex_layer']
>>         self.add(hex_layer)
>>
>>>
>>>> Thanks!
>>>>
>>>
> Hello,
>
> As Claudio said, it's hard to tell without enough code.
>
> When I read that you tried to add 2 ScrollableLayers to a
> ScrollingManager, one showing just your background image and the other one
> containing an empty hexagonal tileset, and you don't see the hexagons, I
> can think of a couple of possible problems:
>
>    1. Your background image is *above* your hexagons, so you won't see
>    them. Make sure you add the different layers with a *z value* in the
>    order required (lower z value for the background).
>    2. As Claudio explained, cocos only supports hexagonal orientation
>    with 'flat at the top'. Make sure your empty tmx map has this kind of
>    orientation.
>
> If you try to highlight the cells using the method set_cell_color, you
> will run into a problem if the cell does not contain any sprite. The method
>  set_cell_color just changes the color of the underlying sprite for this
> cell. In order to make it work, you would need to use a fully-transparent
> hexagon with the color you want to use for the highlight in Tiled. In your
> on_mouse_motion function, instead of changing the color, you could change
> the cell opacity with set_cell_opacity. Use a semi-transparent opacity,
> and you will see a yellowish color in that cell.
>
> Dan.
> --
> 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