piotr409 Posted January 26, 2014 Share Posted January 26, 2014 HeyI'm having troubles with collision group vs layout. Many times debugger says :Uncaught TypeError: Cannot read property 'exists' of undefined phaser.js:35475 Phaser.Physics.Arcade.collideGroupVsTilemapLayerphaser.js:35475 Phaser.Physics.Arcade.collidephaser.js:35380 updategame.js:140 Phaser.StateManager.updatephaser.js:9367 Phaser.Game.updatephaser.js:13166 Phaser.RequestAnimationFrame.updateRAFphaser.js:23204 _onLoopphaser.js:23189 game.js : 140game.physics.collide(layer,rbullets);Layer is normal tilemap made with Tiled.rbullets is group of sprites, tileset.setCollisionRange(0, tileset.total - 1, true, true, true, true); layer = game.add.tilemapLayer(0, 0, map.layers[0].width * tileset.tileWidth, 480, tileset, map, 0);function rocket(x, y) { var rbullet = game.add.sprite(50, 19, 'cannonrocket'); rbullet.x = x; rbullet.y = y; rbullet.body.acceleration.x = -50; rbullets.add(rbullet); }; Collision player - layer works, collision rbullets - sprite work Phaser 1.1.3 Link to comment Share on other sites More sharing options...
Nebulocity Posted January 26, 2014 Share Posted January 26, 2014 I'm very new to this myself, but what is calling the .exists property? A bullet? If so, have you assigned it with something like this? I had the same problem, and another member of the forum pointed out that while the sprite existed, I hadn't actually assigned it to a variable, and thus couldn't reference the "object" because I hadn't actually defined it at all.bullets = game.add.group();for (var i = 0; i < 10; i++){ var bullet = bullets.create(xlocation, ylocation, 'spritename');} Link to comment Share on other sites More sharing options...
Recommended Posts