Tiled Map promblems after "setDesignResolutionSize"

Tiled Map promblems after "setDesignResolutionSize"
0.0 0



For the Facebook-Appstore we want to use a game canvas size of 760x428px (16:9)
The resolution in our game is 1136x640px so we use:

cc.EGLView.getInstance().setDesignResolutionSize(1136, 640,cc.RESOLUTION_POLICY.SHOW_ALL);

the main.js. The index.html looks like:

Your Browser does not support the canvas element

The width and height of the canvasWrap-DIV (760x428px) is definded is the css-sheet.
So far everything is ok.

The problem is that the TiledMap is not drawn correctly if we use the DesignResulationSize. At the beginning of each level everything is alright, but approximately in the middle of the level/map the map is not visible anymore. It looks like the map is not drawn, but that’s not true… the map is drawn on a wrong position (more to the right).

You can test the game here www.lepsworld2.com/LepsWorldFriendsNoFB/LepsWorldFriends/

Can anybody help us?

With best regards, Matthias


Before you set your DesignResolutionSize to 1136x640, how were you telling your tiled maps and sprites their position? Are you sure you always worked in this proportion?

If yes and the problem persists check that you are also defining the content scale factor:

var designSize = cc.size(1136, 640);
var resourceSize = cc.size(760, 428);
director.setContentScaleFactor(resourceSize.width / designSize.width);

Let me know if that was it!

PS: I tried your game both on Firefox and Chrome, and it seems to enter an endless loop (or some other CPU-intensive operation) and hangs when I try to play a level, I manage to get the background and the “floor” to show, but I have to kill the browser’s tab before it gets out of control. What are you using for testing?



Thank you for your answer.

No, that wasn’t the problem, because if I set the DesignResolutionSize to 1136x640 and set the size of my canvas also to 1136x640 (instead of 760x428) it works perfect! If i change the size of the canvas, the problem occurs.

The problem, that you can’t play the game is, that we are using a big Tiled Map…
if you are interested, you can read this for more information :slight_smile:

With best regards, Matthias



Please set you renderMode to 0, Your tilemap is too big, my browser was crashed when opening your site.



I have set the render Mode to 0. Now it works, but not as smooth as with render Mode 1.

With best regards, Matthias