phaserjs / phaser-ce

Phaser CE is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
http://phaser.io
MIT License
1.34k stars 491 forks source link

resizeWorld() is undefined #568

Closed AbyssOfMisery closed 6 years ago

AbyssOfMisery commented 6 years ago

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)

AbyssOfMisery commented 6 years ago

create:function(){

    this.map=this.game.add.tilemap('map1');
    this.map.addTilesetImage('tiles');
    this.layer = this.map.createLayer('floor');
    this.layer.resizeWorld();
nazimboudeffa commented 6 years ago

Hi, Are you looking for how this function works or are you reporting a bug in it ? https://phaser.io/docs/2.4.4/Phaser.TilemapLayer.html#resizeWorld

samme commented 6 years ago

If there's no layer named 'floor', the result of createLayer() will be undefined.

Check the browser console for warnings.

Find the layer names in this.map.layers.

AbyssOfMisery commented 6 years ago

thanks, i have find it out. it's not phaser's problem, its Tiled editor problem, I set zilb compression on.