Answer the question
In order to leave comments, you need to log in
How to include a tile map in phaser.js?
How to properly connect a tile map in phaser.js?
There is a code:
var game = new Phaser.Game(600, 450, Phaser.AUTO, 'game-field', { preload: preload, create: create, update: update });
function preload() {
game.load.image('tiles', '../assets/tilea2.png');
game.load.tilemap('tilemap', '../assets/map.json', null, Phaser.Tilemap.TILED_JSON);
}
function create() {
game.stage.backgroundColor = '#787878';
map = game.add.tilemap('tilemap');
map.addTilesetImage('tilea2.png', 'tiles');
layer = map.createLayer('world');
layer.resizeWorld();
}
function update() {
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question