Hey everyone!!
First of all, my english isn’t perfect so mb for it rsrs. I’m having a trouble to load a tilemap that I made in Tiled Editor. I’ve been looking for every single tutorial on youtube, forums but neither of them helped me. Can u guys help me with it?
Game.js
//<---------------------------------------- MAIN SCENE ----------------------------------->
class mainScene extends Phaser.Scene {
constructor() {
super(‘mainScene’);
}
healthGroup;
timedEvent;
maxHealth = 100;
currentHealth = 100;
player;
item;
text;
preload() {
this.load.image(“player”, “assets/Sprites/Characters/Default/character_yellow_front.png”);
this.load.image(“background”, “assets/Sprites/Backgrounds/Default/background_color_trees.png”);
this.load.image(“item”, “assets/Sprites/Tiles/Default/gem_yellow.png”);
this.load.image(“health”, “assets/Sprites/Tiles/Default/heart.png”);
this.load.image(“tiles”, “assets/Spritesheets/spritesheet-tiles-default.png”);
this.load.tilemapTiledJSON(“level”, “assets/Tilemap/level.json”)
}
create() {
//<---------------------------------------- LEVEL DESIGN ----------------------------------->
const map = this.make.tilemap({ key: "level" });
const tileset = map.addTilesetImage("spritesheet-tiles-default", "tiles");
const groundLayer = map.createLayer("Ground", tileset, 0, 0);
level.JSON
“nextlayerid”:8,
“nextobjectid”:13,
“orientation”:“orthogonal”,
“renderorder”:“right-down”,
“tiledversion”:“1.11.2”,
“tileheight”:64,
“tilesets”:[
{
“columns”:18,
“firstgid”:1,
“image”:“../Spritesheets/spritesheet-tiles-default.png”,
“imageheight”:1152,
“imagewidth”:1152,
“margin”:0,
“name”:“spritesheet-tiles-default”,
“spacing”:0,
“tilecount”:324,
“tileheight”:64,
Waiting for an answer. Thank u guys!!