Jump to content

Setting TileMap size


davidwestAC
 Share

Recommended Posts

Hello,

I'm creating a blank tilemap and then attempting to change the tile size. This works for tile sizes less than or equal to 32x32 tiles,but larger than that the tiles start to squish instead of moving. I'll try and post the relevant code. If you need me to post more I am happy to. This seems like such a simple thing.

var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser_test', { preload: preload, create: create, update: update });

In preload:
game.load.spritesheet('space_backgrounds_image', '/space_backgrounds.png', 64, 64, 1);

In the create function I have:

game.world.setBounds(0,0,1920,1920);
cursors = game.input.keyboard.createCursorKeys();
map = game.add.tilemap();
map.setTileSize(64,64);

map.addTilesetImage('space_backgrounds_image');
layer_background = map.create('space_backgrounds', 40, 30, 64, 64);
layer_background.resizeWorld();
map.putTile(1,5,5, layer_background);
map.putTile(1,2,2, layer_background);

If I remove map.setTileSize, or just reduce the tile size to <= 32x32, things display and scale fine. Anything above that and the tiles aren't moving. At 64x64 the image the map.putTile statements is placing is invisible. I'm sure I'm just missing something obvious. Thank you for any help.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...