notalentgeek Posted August 12, 2015 Share Posted August 12, 2015 I want to display my map that I have just created from Tiled in Phaser. This is code.var statePreload = { preload: function(){ game.load.tilemap ('TileMap1', 'assets/tilemaps/32TilesPlatformScifi.json', null, Phaser.Tilemap.TILED_JSON); game.load.image ('ImageTileMap1', 'assets/tilesets/32TilesPlatformScifi.png'); }, create: function(){ game.state.start('StateGame'); } };var stateGame = { create: function(){ this.map = game.add.tilemap('TileMap1'); this.map.addTilesetImage('32TilesPlatformScifi', 'ImageTileMap1'); }, update: function(){} };var game = new Phaser.Game(672, 672, Phaser.AUTO, 'gameDiv'); game.state.add ('StateBoot', stateBoot); game.state.add ('StatePreload', statePreload); game.state.add ('StateGame', stateGame); game.state.start('StateBoot'); http://pastebin.com/K9CY8jfU When I run, there is no error (no error in the console), it is just the map I created with Tiled is not showing off (black screen). What could be the problem? Tilde 1 Link to comment Share on other sites More sharing options...
notalentgeek Posted August 12, 2015 Author Share Posted August 12, 2015 My bad. It is supposed to be like this.create: function(){ this.map = game.add.tilemap('TileMap1'); this.map.addTilesetImage('32TilesPlatformScifi', 'ImageTileMap1'); this.layerBackground = this.map.createLayer('LayerBackground'); this.layerBlock = this.map.createLayer('LayerBlock');} Tilde 1 Link to comment Share on other sites More sharing options...
Recommended Posts