Thanks for your help. But i do get an error when i include my object group as u suggested.
Code: Select all
var map1 = { "height":100,
"layers":[
{
"height":20,
"name": "SpawnPoints",
"objects": [
{
"height":128,
"name":"",
"properties":
{
},
"type":"",
"visible": true,
"width": 128,
"x":124,
"y":128
},
{
"height":144,
"name":"",
"properties":
{
},
"type": "",
"visible": true,
"width": 152,
"x": 0,
"y":0
}],
"opacity": 1,
"type":"objectgroup",
"visible": true,
"width":20,
"x": 0,
"y":0
},
{
"data":[
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
"height":10,
"name":"GrassLayer",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":100,
"x":0,
"y":0
},
{
"data":[
5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"height":100,
"name":"DirtLayer",
"opacity":1,
"type":"tilelayer",
"visible":true,
"width":100,
"x":0,
"y":0
}],
"orientation":"isometric",
"properties":
{
},
"tileheight":50,
"tilesets":[
{
"firstgid":1,
"image":"..\/gaming\/assets\/textures\/tiles\/grassSheet.png",
"imageheight":50,
"imagewidth":400,
"margin":0,
"name":"grassSheet",
"properties":
{
},
"spacing":0,
"tileheight":50,
"tilewidth":100
},
{
"firstgid":5,
"image":"..\/gaming\/assets\/textures\/tiles\/dirtSheet.png",
"imageheight":50,
"imagewidth":400,
"margin":0,
"name":"dirtSheet",
"properties":
{
},
"spacing":0,
"tileheight":50,
"tilewidth":100
}],
"tilewidth":100,
"version":1,
"width":10
};
if (typeof(module) !== 'undefined' && typeof(module.exports) !== 'undefined') { module.exports = map1; }
and this is how i load it. I try to make it simple as possible as long it can load the map.
The error i got is Uncaught TypeError: Object #<Object> has no method 'tileWidth' ,'tileHeight' , 'autosection', 'mount' , which is cause by the .tileWidth(40) and so on. So how can i load it without getting this error?