WirelessKiwi Posted April 11, 2015 Share Posted April 11, 2015 Hi, I'm new to Phaser and I'm trying to import a tilemap from a Tiled json file but I got the following error while adding a tileset image.Uncaught TypeError: undefined is not a function game.js:22I understand that addTilesetImage is undefined but I don't know why. When I do a console.log(map), I can see in the console that it is a Tilemap object. I'm using the latest minifed version of Phaser. Here is the code :window.onload = function() { var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create}); function preload () { game.load.tilemap('map','assets/tilemaps/maps/level-test.json', null, Phaser.Tilemap.TILED_JSON); game.load.image('tiles','assets/tilemaps/tiles/roasted_set.png'); game.load.image('logo', 'assets/tilemaps/tiles/roasted_set.png'); } var map; var layer1; function create () { game.stage.backgroundColor = '#9ACBE8'; map = game.add.tilemap('map'); map.addTilesetImage('roasted_set', 'tiles'); layer1 = map.createLayer('level'); layer1.resizeWorld(); layer1.wrap = true; }}; Link to comment Share on other sites More sharing options...
Recommended Posts