Example Iso Map file
Shri

Gio,

Could you post a sample map file. As per the isometric api documentation from wade.iso.init()

map: A string pointing to a JSON file that contains a map to load

thanks - shri

1 Comment
Gio

Hi Shri

The best way to see this is by creating a simple map in the editor.

The scene (.wsc) file, contains a json object whith a "modules" property.

All the things that are in "modules" are loaded by separate modules. So modules.iso contains the data that wade.iso will load.

Here's an example one:

{
	"version": "1.1",
	"terrain": {
		"numTilesX": 4,
		"numTilesZ": 2,
		"tileData": [
			{
				"texture": "grass.png"
			},
			{
				"texture": "sand.png"
			},
			{
				"texture": "rock.png"
			},
			{
				"texture": "water.png"
			}
		],
		"tileDataIds": [
			[
				0,
				1
			],
			[
				2,
				1
			],
			[
				3,
				3
			],
			[
				3,
				3
			]
		],
		"transitionData": [],
		"transitionDataIds": [
			[
				-1,
				-1
			],
			[
				-1,
				-1
			],
			[
				-1,
				-1
			],
			[
				-1,
				-1
			]
		],
		"detailData": [],
		"detailDataIds": [
			[
				-1,
				-1
			],
			[
				-1,
				-1
			],
			[
				-1,
				-1
			],
			[
				-1,
				-1
			]
		],
		"tileHeight": [
			[
				0,
				1
			],
			[
				2,
				3
			],
			[
				4,
				5
			],
			[
				6,
				7
			]
		]
	}
	{
	"gameObjectData": [
		{
			"name": "woodcutter",
			"type": "isometric object",
			"scale": 1,
			"rotation": 0,
			"customHeight": false,
			"sprites": [
				{
					"sortPoint": {
						"x": 0,
						"y": 0.5
					},
					"imageArea": {
						"minX": 0,
						"minY": 0,
						"maxX": 1,
						"maxY": 1
					},
					"offset": {
						"x": 40,
						"y": -167,
						"angle": 0
					},
					"range": {
						"x": 1,
						"y": 7
					},
					"image": "base_woodcutter_wood_iso_ne.png",
					"size": {
						"x": 1024,
						"y": 512
					},
					"layer": 25,
					"currentAnimation": "",
					"visible": true
				},
				{
					"animations": {
						"woodcutter_wood_iso_ne": {
							"name": "woodcutter_wood_iso_ne",
							"numCells": {
								"x": 2,
								"y": 4
							},
							"startFrame": 1,
							"endFrame": 7,
							"image": "anim_woodcutter_wood_iso_ne.png",
							"speed": 10,
							"autoResize": false,
							"offset": {
								"x": 0,
								"y": 0
							},
							"looping": true
						}
					},
					"sortPoint": {
						"x": 0,
						"y": 0.5
					},
					"imageArea": {
						"minX": 0,
						"minY": 0,
						"maxX": 1,
						"maxY": 1
					},
					"offset": {
						"x": -67,
						"y": -71,
						"angle": 0
					},
					"image": "",
					"size": {
						"x": 256,
						"y": 256
					},
					"layer": 25,
					"currentAnimation": "woodcutter_wood_iso_ne",
					"visible": true
				}
			],
			"collisionMap": [
				{
					"x": 0,
					"z": 0
				}
			],
			"gridMap": [
				{
					"x": 0,
					"z": 0
				}
			],
			"behaviors": [],
			"imageArea": {
				"minX": 0,
				"minY": 0,
				"maxX": 1,
				"maxY": 1
			},
			"collision": false
		}
	],
	"gameObjects": [
		{
			"templateId": 0,
			"gridCoords": {
				"x": 1,
				"z": 0
			},
			"instanceData": 
			{
				"name": "woodcutter_0"
			}
		}
	]
}

The idea is that instead of repeating the same tile data every time it's used on the map, we first define an array of all the different tile types that are present on the map, then the map data is essentially made of indices into this array.

There are several "levels" of data: base terrain, terrain transitions, terrain details and game objects.

You'll notice that all the terrain data has the same structure, and that the game object data uses the exact same data types (e.g. Sprites and Animations) as normal non-iso objects.

Post a reply
Add Attachment
Submit Reply
Login to Reply