Phaser sizeWorld() undefined
发布于 6 年前 作者 AbyssOfMisery 1130 次浏览 来自 问答

google 游览器下运行

  • Uncaught TypeError: Cannot read property ‘resizeWorld’ of undefined

  • at Game.Level1.create (Level1.js:16)

  • at i.StateManager.loadComplete (phaser.min.js:3)

  • at i.StateManager.preUpdate (phaser.min.js:3)

  • at i.Game.updateLogic (phaser.min.js:3)

  • at i.Game.update (phaser.min.js:3)

  • at i.RequestAnimationFrame.updateRAF (phaser.min.js:3)

  • at window.requestAnimationFrame.forceSetTimeOut._onLoop (phaser.min.js:3)

    create:function(){

    this.map=this.game.add.tilemap('map1');
    this.map.addTilesetImage('tiles');
    this.layer = this.map.createLayer('floor');
    this.layer.resizeWorld();

请问我哪里写错了?

2 回复

检查你的json中有没有一个名为“floor”的层?

谢谢啊,不过我找出原因了.是因为我用tilemap editor 点了zilb压缩,然后phaser不支持这个.

回到顶部