Moonbox Posted December 5, 2014 Share Posted December 5, 2014 Hi, I'm building a game in Phaser but I came along a strange bug. Whenever I'm testing the game and I open the developers tools (or another action like 'right click > copy image'), my character stops colliding with the tile map. This also seems to happen sometimes when I change the desktop on my mac. I searched a long time but can't seem to fix it. Any ideas?Here is my code:var mainState = { preload: function(){ game.load.tilemap('map','assets/tilemap.json', null, Phaser.Tilemap.TILED_JSON); game.load.image('tileset','assets/tileset.png'); game.load.atlas( 'atlas', 'assets/atlas_char.png', 'assets/atlas_char.json' ); }, create: function(){ game.physics.startSystem(Phaser.Physics.ARCADE); game.stage.backgroundColor = '#dadada'; game.world.bounds.setTo(0,0,1200,800); this.player = game.add.sprite(45,670,'atlas'); game.physics.arcade.enable(this.player); this.player.body.collideWorldBounds = true; this.player.body.gravity.y = 250; this.createWorld(); game.camera.follow(this.player); this.cursor = game.input.keyboard.createCursorKeys(); game.input.keyboard.addKeyCapture([Phaser.Keyboard.UP, Phaser.Keyboard.DOWN, Phaser.Keyboard.LEFT, Phaser.Keyboard.RIGHT]); }, update: function(){ game.physics.arcade.collide(this.player, this.layer); }, createWorld: function(){ this.map = game.add.tilemap('map'); this.map.addTilesetImage('tileset'); this.map.setCollision(1); this.layer = this.map.createLayer('Tile Layer 1'); this.layer.debug = true; this.layer.resizeWorld(); }};var game = new Phaser.Game(800, 500, Phaser.CANVAS, 'gameDiv');game.state.add('main',mainState);game.state.start('main'); Link to comment Share on other sites More sharing options...
Recommended Posts