Uncaught TypeError: Cannot read property 'height' of undefined for a phaser game, using a Tiled map

It looks like you’re trying to add tileset images under the wrong names (groundtop1, player1).

Expand the Tilesets: … list in the console to see what the names are.

I have renamed the tileset images, and now the browser comes up with an error related to cache and width:

So this one is is phaser related. When you declare a gameobject in your preload method you have to call it with its key in the create or update

Which parameter is the key? Is it the first or the second?

This is the basic example to understand the key feature https://phaser.io/examples/v2/basics/01-load-an-image

I have now tried to stay consistent with the example you sent, but the error persists

The width error is an error you mentionned early in this thread, for me it still means that you haven’t initialised your variable, but it’s a javascript error

Ok, then what could must I add, as I am completely unsure at this point?

If you can share your game on GitHub or dropbox or even a zip file in the forum it will be easier

ok sure, i’ll try and zip it

1 Like

So here is a little bug hunting of your code on my YouTube Channel
https://www.youtube.com/watch?v=O21Z1I9K0rs

This error occurs in Chrome Browser when you read a property or call a method on an undefined object . Uncaught TypeError: Cannot read property of undefined error is probably easiest to understand from the perspective of undefined, since undefined is not considered an object type at all (but its own undefined type instead), and properties can only belong to objects within JavaScript. There are a few variations of this error depending on the property you are trying to access. Sometimes instead of undefined it will say null.