Hello!
Our game uses tile maps and we render characters (sprites) nicely within the isometric map layers and tiles (a screenshot will follow below). So far, we are using version 2.2.3 and I recently started trying to update to version 3.2. I found there is a difference in the way the characters are rendered on the map and it is wrong in version 3.2.
Here is what it looks like with version 2.2.3. You can see that the squid is covered by the palm tree, etc. and it looks nice:
Now here is what it looks like with version 3.2. The squid still integrates nicely in the map but its transparent background is black:
Here are some details on how I place the sprites on the map:
- The map has several layers, and I have set the cc_vertexz property to ‘automatic’ on all of them. This doesn’t realy matter in the end, as I set my own values (see next point);
- I set the vertex z of each tile on the map myself, as the map is actually more complicated than the simple two-layers example and needs finer control. As you can see, it works fine (in 2.2.3), so there is no problem there;
- I set the vertex z of each sprite I place using the same calculation that was used for the tiles, so that a sprite has the same vertex z (well, +1) as the tile it is standing on, which is essentially the same way the example works;
- I set the z order of each sprite I place to a big number, so that it would be rendered after everything else around it on the map, and it would alpha-blend correctly.
I have seen the example for tile maps in version 3.2, I have also seen its code and that it works perfectly. However, there is one difference in my code, that has been neglected by the original author of the test - the sprite that moves in the test is actually a tile from the map and in my code, it is an actual sprite that is loaded separately. I have made the absolutely same test on my map - I made a tile from the map move around. That works fine. So, the problem seems to be that a sprite (that is not a tile) can not be placed on the map in version 3.2.
I haven’t dug too much in the code of cocos2d-x but my guess is that in version 2.2.3, the z order was used to order the draw calls, and it is not in version 3.2. In version 3.2, I think the positionZ property should be used to order objects for rendering from back to front but it seems it is not. It seems that my sprites are probably rendered before the layers of the map and alpha blending does not work.
This looks like a bug in version 3.2 (possibly in earlier 3.x versions too) to me. Please, if any of the developers sees this, comment on whether you could confirm they can reproduce that and whether it is really a bug. If that is so, I could re-post this in the issue tracker.
Cheers!