Я создаю игру с помощью движка Phaser, и в настоящее время я использую приложение «Tiled» для создания собственной тайловой карты.
Настоящая проблема, похоже, связана с наличием нескольких слоев при создании этой карты тайлов. У меня есть 6 разных слоев:
- "Фон"
- "ВоллБлокс"
- "Трава"
- "СпайкАнимация"
- "ДаймондАнимация"
- "СлаймАнимация"
Вот мой файл Game.js
SleepSim.Game = function (game) {
this.map;
this.Background;
this.WallBlocks;
this.Grass;
this.SpikeAnimation;
this.DiamondAnimation;
this.SlimeAnimation;
}
SleepSim.Game.prototype = {
create: function () {
this.world.setBounds(0,0,5000,1000);
this.map = this.add.tilemap('gameWorld');
this.map.addTilesetImage('gameworld', 'tiles');
this.Background = this.map.createLayer('Background');
this.Background.resizeWorld();
this.WallBlocks = this.map.createLayer('WallBlocks');
this.Grass = this.map.createLayer('Grass');
this.SpikeAnimation = this.map.createLayer('SpikeAnimation');
this.DiamondAnimation = this.map.createLayer('DiamondAnimation');
this.SlimeAnimation = this.map.createLayer('SlimeAnimation');
},
update: function() {
if(this.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
this.camera.y += 10;
}
else if (this.input.keyboard.isDown(Phaser.Keyboard.UP)){
this.camera.y -= 10;
}
if (this.input.keyboard.isDown(Phaser.Keyboard.LEFT)){
this.camera.x -= 10;
}
else if (this.input.keyboard.isDown(Phaser.Keyboard.RIGHT)){
this.camera.x += 10;
}
}
}
В данный момент я настроил камеру таким образом, чтобы просто летать по карте, чтобы убедиться, что все может загрузиться.
Извиняюсь, если форматирование этого вопроса немного не так, это моя первая публикация! Любая помощь будет супер супер оценена.