Jump to content

Phaser - black screen when load tilemap json


patmaba
 Share

Recommended Posts

Hello,

 

I'm making my first step with Phase and json map.

I have build a simple map with tile map editor(http://www.mapeditor.org/)  exported as json format.

When i launch my html page a black screen appear. Why ?

 

All my project is into zip file "phaser_map_test_case_dont_work_01.zip"

 

I'm using moongose as local web server on a windows 8.1 machine.

 

Where is my error ? What is wrong ? Can you help me ?

 

Thanks

 

Patmaba

<!doctype html><html>    <head>        <meta charset="UTF-8" />        <title>hello phaser!</title>        <script src="phaser.min.js"></script>    </head>    <body>    <script type="text/javascript">    window.onload = function() {                var game = new Phaser.Game(800, 600, Phaser.CANVAS,'', { preload: preload, create: create, update: update });                function preload() {            game.load.tilemap('foreground', "assets\\map\\area01.json", null, Phaser.Tilemap.TILED_JSON);              game.load.image('img', "assets\\map\\area01.png");         }                 function create() {            var map = game.add.tilemap('foreground');            map.addTilesetImage('area01_tiles', 'img');            var layer = map.createLayer('mylayer');            layer.resizeWorld();                    }        function update() {        }    };    </script>    </body></html>

my json map

{ "backgroundcolor":"#0055ff", "height":15, "layers":[        {         "data":[21, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 21, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 0, 21, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 25, 25, 25, 25, 5, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 24, 25, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],         "height":15,         "name":"foreground",         "opacity":1,         "type":"tilelayer",         "visible":true,         "width":20,         "x":0,         "y":0        }], "orientation":"orthogonal", "properties":    {    }, "renderorder":"right-down", "tileheight":32, "tilesets":[        {         "firstgid":1,         "image":"area01.png",         "imageheight":241,         "imagewidth":640,         "margin":0,         "name":"area01_tiles",         "properties":            {            },         "spacing":0,         "tileheight":32,         "tilewidth":32,         "transparentcolor":"#ff00ff"        }], "tilewidth":32, "version":1, "width":20}

phaser_map_test_case_dont_work_01.zip

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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