| 36 | |
| 37 | // 4 cols x 3 rows = 12 cells, with a mix of empty (0) and populated cells |
| 38 | function buildMapJSON(data) { |
| 39 | return { |
| 40 | width: 4, |
| 41 | height: 3, |
| 42 | tilewidth: 32, |
| 43 | tileheight: 32, |
| 44 | orientation: "orthogonal", |
| 45 | renderorder: "right-down", |
| 46 | infinite: false, |
| 47 | version: "1.10", |
| 48 | tiledversion: "1.12.0", |
| 49 | tilesets: [tilesetData], |
| 50 | layers: [ |
| 51 | { |
| 52 | type: "tilelayer", |
| 53 | name: "Background", |
| 54 | width: 4, |
| 55 | height: 3, |
| 56 | data, |
| 57 | visible: true, |
| 58 | opacity: 1, |
| 59 | }, |
| 60 | ], |
| 61 | }; |
| 62 | } |
| 63 | |
| 64 | function makeLayer(data) { |
| 65 | const map = new TMXTileMap("test", buildMapJSON(data)); |