**I want to load the image in black box, but the cocos actually loaded in the red box image.**This looks like the cocos when calculating the horizontal position to the right more added a grid position…
this is my image in html:
I originally guess atlas is too large, tried many times to the size of the atlas decrease but the problem still exists.
have not found a similar situation in network, I will study the cocos source if cant find a solution
Engine: cocos2d - HTML 3.12
Tiled: v1.0.3
It seems indeed to be off by one, so it is likely some problem in their code. If you’re using a non-zero margin, this may be the problem:
Since the expression should only subtract the margin once and not twice (since it’s irrelevant whether the margin exists also at the bottom or the right side of the image).
Thank you very much for your help. I have found the solution to the problem, and I have finally solved the BUG that has been bothering me for several nights.
Probably because of the different cocos version, the code snippet that you point to is not found in my engine file.But it led me to another place where the cocos team seems to know the Bug but it’s not fixed now:
I changed 0 to 1 and the problem was solved.
Very happy!
Ah, this is a bug in handling external tilesets, where they need to load this firstgid attribute from the map file and not the tileset file. Your fix probably only works in case the map is only using a single tileset.
It seems like their commented code should fix the problem. I wonder why it is commented out.