移相器:如何显示使用JSON文件的另一个地图?

问题描述 投票:0回答:1

上下文

我下Phaser工作(这是一个JavaScript框架,用于游戏开发),我跟着this totorial。所有代码完美的作品。但是,为了使地图教程使用.json文件,该文件内容的data一部分,以显示地图。

screenshot


问题

我想更改地图,并显示自己的地图。下面是显示地图的map.json

{ "backgroundcolor":"#000000",
 "height":10,
 "infinite":false,
 "layers":[
        {
         "data":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAAAAAAAAAAAAAAAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAAAAAAAAAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAMAAAADAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAABQAAAAUAAAAFAAAA",
         "encoding":"base64",
         "height":10,
         "name":"World",
         "opacity":1,
         "type":"tilelayer",
         "visible":true,
         "width":30,
         "x":0,
         "y":0
        }],
 "nextobjectid":31,
 "orientation":"orthogonal",
 "renderorder":"right-down",
 "tiledversion":"2018.03.21",
 "tileheight":70,
 "tilesets":[
        {
         "columns":4,
         "firstgid":1,
         "image":"tiles.png",
         "imageheight":280,
         "imagewidth":280,
         "margin":0,
         "name":"tiles",
         "spacing":0,
         "tilecount":16,
         "tileheight":70,
         "tilewidth":70
        }, 
        {
         "columns":1,
         "firstgid":17,
         "image":"coinGold.png",
         "imageheight":70,
         "imagewidth":70,
         "margin":0,
         "name":"coin",
         "spacing":0,
         "tilecount":1,
         "tileheight":70,
         "tilewidth":70
        }],
 "tilewidth":70,
 "type":"map",
 "version":1.2,
 "width":30
}

我知道,为了显示在地图中使用的部分是layers.data

这些是什么字母一回事呢?是否是一种特殊格式的,我从来没有听说过这么远?

我如何,我应该知道的字母对应于瓷砖?

如果您需要更多的信息,或者如果您有任何问题,请让我知道,谢谢!

javascript json phaser-framework game-development tiled
1个回答
1
投票

该地图使用Tiled它使您可以使用一组瓦片(又名精灵)的瓷砖地图上进行。在JSON导出它允许您将它轻松导入到游戏引擎,在这种情况下,移相器。

手工做这些可能会很麻烦所以像瓷砖的tilemap的编辑器可以帮助您加快地图的开发。您还可以创建并以编程方式将每个瓦片但它取决于你的目标在这类型的游戏。

here's如何使用瓷砖创建地图的入门教程。请务必将其保存为JSON而不是.tmx这样你就可以在移相器导入。

© www.soinside.com 2019 - 2024. All rights reserved.