I'm not sure I understand your goals...
On Thu, Sep 8, 2016 at 6:43 PM, Robert Haddon <[email protected]>
wrote:
>
> This appears to be a very uncommon pattern and I've been struggling to
> make it work.
>
> I have single hand-painted world map that I want to use for my game's
> background, but I also need a hexagonal tileset for the user to interact
> with, and I need it to scroll.
>
You want
- the image to scroll
- highlight hexagonal areas, probably ones under the mouse cursor ?
> I'm not sure what the best solution is for this. This is what I have
> tried:
>
1. Load my image as a tileset image into Tiled and produce a TMX file.
> Code-wise in cocos, this works fine but it looks awful because Tiled
> tilesets are rectangular and painting those cells over hex cells just
> doesn't work aesthetically.
>
Tiled (and cocos) supports hexagonal tilesets. If you break the image in
hexagons (an "hexagonal tileset"), and do the related map, then you can
accomplish what I interpret are your requirements.
I would write a script using pygame (or search a minitool ) to partition
the image into the hexagonal tileset,
Caveat: theres two possible orientations for hexagons in an hexagonal map
('flat at the top' or "corner at the top"), Currently cocos supports only
one of the orientations.
You can see the test_tmx_hexmap.py as example for highlight tile under
cursor (in the repo or the distributed tarball/zip, subdir test/ )
>
> 2. Add two ScrollableLayers to a ScrollingManager, one for the image and
> one for a TMX file with nothing but an empty hexagonal tileset defined.
> I'm experiencing various problems here, depending on how I implement it:
> The hexagons don't seem to paint--I have some on_mouse_motion code to
> highlight the cell under the mouse but it doesn't work when used in this
> way (no errors but nothing visible happens). All I see is the background
> image.
> I get 'pyglet.gl.lib.GLException: b'invalid operation' when loading the TMX
>
Can't tell without code.
>
> Before I post code, does anybody know if what I want to do is even
> possible?
>
>
> Thanks!
> .
>
--
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.