I got an error when I create a map with 3 tile layer and 1 object layer (foreground, background, meta, and objects layer).
when I load it, I got an error “Unhandled exception at 0x58F22996 (libcocos2d.dll) in **.exe: 0xC0000005: Access violation reading location 0x00000038.”
And it stop at class CCTexture2D
I test with a map has 2 tile layer and 1 object layer -> it works.
how can fix it? please help me. thanks
ok I figured this out. its a relative file problem.
If you have your tilemap and images in a sub folder of resources, the api will attempt to load images relative to resources folder rather than the sub folder that holds both tmx and tilemap images.
Quick solution is to place tmx file and its images in the root resources folder.
I have also found that if you have any tile layer that does not have at least one tile reference a tileset then the access violation in Texture2D::hasPremultipliedAlpha() occurs. I have found that if I remove these empty layers from the tmx file, the problem goes away.
I have in the past used Corona SDK and Million Tile Engine. I used empty tile layers to place my main character on a different layer depending upon his location on the screen. this allowed me to z-order the character based upon its y-pos.
The way to achieve this in cocos2d-x is slightly different and explained here:
I’ve got the same issue today.
I found it is the problem of picture file type of tiled map. I solved this issue by converting the file from ‘gif’ type to ‘png’ type.
I guess cocos2dx doesn’t support the ‘gif’ file type.