Map not appearing

Recommended Posts

My game isn't loading the map I made using tiled. The file, testroom1.json, is called properly, but something in my game.js is keeping the game from loading the map itself.

var RPG = RPG || {};

RPG.GameState = {
    init: function (currentLevel) {
        //Needed to keep track of the level
        this.currentLevel = currentLevel || currentLevel === 'testroom1';
        //movement speed constants
        this.PLAYER_SPEED = 90;
        //no gravity in top down games = 0;
        //keyboard cursors for input
        this.cursors =;
    create: function () {
        this.Game.onscreenControls =;
    update: function () {
    loadLevel: function () {
        //create the tilemap object = this.add.tilemap(this.currentLevel);
        //Join the tile images to the .json data'tileset', 'tilesheet');
        //create tile layers
        this.backgroundLayer ='backgroundLayer');
        //this.collisionLayer ='collisionLayer');
        //set background to the back of screen;
        //Collision Layer... if only I made it earlier
        //, 16, true, 'collisionLayer');
        //resize the world to fit the layer
    gameOver: function () {'Game', true, false, this.currentLevel);

I never made the collision layer. I plan on doing that AFTER getting the map to appear first.

Does anyone have any advice on how to tackle this?

Share this post

Link to post
Share on other sites

I just tried that, and now my browser's console says that the .csv file isn't found. How do I find it?


UPDATE: I got the .csv file to be found. Now I'm getting an error about the onscreenControls.js that game.js is trying to use. It says 'cannot set property 'onscreenControls' of undefined. How do I deal with this?

Edited by Thunderfist

Share this post

Link to post
Share on other sites

I think I found the big error! It's saying that the program can't read property width of undefined for this.loadLevel in my create function, and this.add.tilemap in the loadLevel function.


What do I do?

Share this post

Link to post
Share on other sites

Cannot read property 'loadTilesetImage' of undefined 

                  at Object.preload (game.js:20)


All that function is doing is trying to load the map terrains from the preload.js. I'm worried that I won't finish this project before May, and I'm still stuck on this part!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.