Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Received error when loading my map #10

Open
dlentz-ibm opened this issue May 23, 2020 · 1 comment
Open

Received error when loading my map #10

dlentz-ibm opened this issue May 23, 2020 · 1 comment

Comments

@dlentz-ibm
Copy link

dlentz-ibm commented May 23, 2020

I received the following error when calling this.animatedTiles.init

Uncaught TypeError: Cannot read property 'type' of null

What I found was that if there is a layer in the tile map JSON which has not been added to the map using Phaser APIs (createStaticLayer/createDynamicLayer) then that layer will not have a 'Type' property and the animatedTiles.init fails.

Since this plugin requires animated layers to by DynamicLayers I changed line of code 410 in AnimatedTiles.js from this:

if (layer.tilemapLayer.type === "StaticTilemapLayer") {

to this:

if ((!layer.tilemapLayer) ||
    (!layer.tilemapLayer.type) ||
    (layer.tilemapLayer.type === "StaticTilemapLayer")) {

This fixed my issue because my animatedTiles.js is ignoring all layers that are not dynamic however I wanted to share this in case others hit this issue.

@blopa
Copy link

blopa commented Sep 26, 2021

Thanks for sharing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants