Jump to content

Phaser Tilemap with layers, how to load?


Mizukage
 Share

Recommended Posts

I have map what I made in 'Tiled' this map have two layers 'firstFlor' and 'firstFloorBlock' and mape have a name 'map1'
and for make this map I used three tilesets png with names tile1 tile2 tile3

Than I load those stuff in preload.js like a 

        this.game.load.tilemap('map1', 'maps/map1.json', null, Phaser.Tilemap.TILED_JSON);        this.game.load.image('tile1', "maps/tile1.png");        this.game.load.image('tile2', "maps/tile2.png");        this.game.load.image('tile3', "maps/tile3.png");

And here is the point, I have no idea how to load those things in game in create function

map = this.game.add.tilemap('map1');        map.addTilesetImage('tile1');        map.addTilesetImage('tile2');        map.addTilesetImage('tile3');        layer = map.createLayer('firstFloor');        layer.resizeWorld();        layer.wrap = true;        var layer2 = map.createLayer('firstFloorBlock');

But is a pice of scrap... and not working at all

Link to comment
Share on other sites

We'll need a bit more information:

  • Could you post your JSON file and your three tilemaps (e.g., tile1.png, tile2.png, tile3.png)
  • What do you mean that it is not working? Are you not seeing anything on the screen?
  • Post a bit more of your code, or you entire code setup so that we can see what your game width/height is, etc.
Link to comment
Share on other sites

That was an error with coding style, map has 64..... Phaser need SVN If Im right

 

 

I'm sorry, but I'm not sure what you are referring to. If you place your code and JSON files in something like http://pastebin.com, and upload your tiles images to something like http://imgur.com -- it will enable us to help you figure out what the issue might be.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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