Jump to content

tilemap top space problem


pugliese
 Share

Recommended Posts

Hello, I am new to Phaser and I am testing tilemaps.

Any idea why my tilemap loads messed up?
- Specially the 32px padding on top, how do I set it to be on x:0, y:0 of the game?

code:
 

game = new Phaser.Game(800, 640, Phaser.AUTO, '', { preload: preload, create: create, update: update });game.load.tilemap('map', '/images/game/test.json', null, Phaser.Tilemap.TILED_JSON);game.load.image('tarmac', '/images/game/tarmac.png');game.load.image('192x192', '/images/game/192x192.png');game.physics.startSystem(Phaser.Physics.ARCADE);game.stage.backgroundColor = '#616161';game.map = game.add.tilemap('map', 8, 8);game.map.addTilesetImage('40', 'tarmac', 40, 40);game.map.addTilesetImage('192x192', '192x192', 192, 192);game.layer = game.map.createLayer('Tile Layer 1');

tile:
http://pastebin.com/rp67xmzq

Thanks
C.

post-8040-0-95317500-1440454212.pngpost-8040-0-15433600-1440454213_thumb.pn

 

Link to comment
Share on other sites

I'm not sure... but your map species a tile size of 8x8, but your two tile sets at 40x40 and 192x192 (as in the tilewidth and tileheight properties in the map JSON). I'm *fairly* certain that Phaser will just crop the images..? But, from your screenshot, I bet the gray area is pushed down 40px and the blue area is pushed down 192px?

 

Or maybe 32px and 184px?

 

I don't know if that's related to your problem, but it jumped out at me.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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