Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Tilemap issue


Mohammed Salman
 Share

Recommended Posts

Hey guys I'm new to Phaser, I looked on Youtube and phaser examples for answers but didn't find any helpful one.

I get this error on the console

TypeError: location is undefined[Learn More]  phaser.js:97736:25
	getIndex http://127.0.0.1:5000/assets/phaser.js:97736:25
	getTilesetIndex http://127.0.0.1:5000/assets/phaser.js:97770:16
	addTilesetImage http://127.0.0.1:5000/assets/phaser.js:97313:19
	create http://127.0.0.1:5000/main.js:36:5
	loadComplete http://127.0.0.1:5000/assets/phaser.js:28709:13
	finishedLoading http://127.0.0.1:5000/assets/phaser.js:75801:9
	processLoadQueue http://127.0.0.1:5000/assets/phaser.js:75756:13
	asyncComplete http://127.0.0.1:5000/assets/phaser.js:75828:9
	fileComplete http://127.0.0.1:5000/assets/phaser.js:76711:13
	loadImageTag/file.data.onload http://127.0.0.1:5000/assets/phaser.js:76098:17

Here is my code:

var game = new Phaser.Game(500, 400, Phaser.AUTO, "", {
    preload: preload,
    create: create,
    update: update
});

function preload() {
    game.load.spritesheet(
        "marioSmall",
        "assets/images/marioSmall.png",
        34,
        34,
        6,
        1
    );
    game.load.image("ground", "assets/images/ground.png");
    game.load.tilemap(
        "map_01",
        "assets/tileset_json.json",
        null,
        Phaser.Tilemap.TILED_JSON
    );
    game.load.image("tiles", "/assets/items.png");
}

var mario;
var ground;
var map;
var layer;
function create() {
    // ground = game.add.sprite(0, 370, "ground");
    // game.physics.arcade.enable(ground);
    // ground.body.immovable = true;
    // mario = new Mario(100, 100, 2000, 800, 200);
    map = game.add.tilemap("map_01");
    map.addTilesetImage("items", "tiles");
    layer = map.createLayer("Tile Layer 1");
}

function update() {
    // game.physics.arcade.collide(ground, mario.sprite);
    // mario.checkInput();
}

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...