mariogarranz Posted January 19, 2014 Share Posted January 19, 2014 I have a number of groups in my game. These are all created at the create function of my game: function create() { game.stage.backgroundColor = '#7ACBE6'; // Activar registro de la actividad del ratón game.input.recordPointerHistory = true; game.input.recordRate = 20; game.input.recordLimit = 10;if(!game.device.desktop){game.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL;game.stage.scale.setShowAll();game.stage.scale.refresh();}contador = game.time.now; game.add.sprite(0,0,'background'); fallingFoodGroup = game.add.group(); game.add.sprite(0,0,'topBar'); game.add.sprite(0,404,'table'); dishesGroup = game.add.group(); plateFoodGroup = game.add.group(); var separacionPlatos = (game.world.width - 2 * PLATO_MARGEN - 3 * 75) / 2;dishesGroup.add(new Plato(game,PLATO_MARGEN, PLATO_ALTURA)); dishesGroup.add(new Plato(game,PLATO_MARGEN + 75 + separacionPlatos, PLATO_ALTURA)); dishesGroup.add(new Plato(game,PLATO_MARGEN + 2 * (75 + separacionPlatos), PLATO_ALTURA)); draggedFoodGroup = game.add.group();} Then, at the update loop, I have this physics call which looks for overlaps between 2 of those groups.game.physics.overlap(draggedFoodGroup,dishesGroup,alimentoPlatoHandler,null,this);Everything was working fine, until I added another group.Just adding this line at the end of the create funciton:comandaGroup = game.add.group();will cause the game to crash with the following error: Uncaught TypeError: Cannot read property 'exists' of undefined phaser.min.js:10 d.Physics.Arcade.overlapGroupVsGroupphaser.min.js:10 d.Physics.Arcade.overlapphaser.min.js:10 updategame.js:117 d.StateManager.updatephaser.min.js:4 d.Game.updatephaser.min.js:5 d.RequestAnimationFrame.updateRAFphaser.min.js:8 window.requestAnimationFrame._onLoopphaser.min.js:8 game.js:117 is the line that checks for overlaps between 2 groups mentioned earlier.Either removing the new group creation, or the overlap check will make the game work just fine. But having both of them added at the same time will cause that error. Note that I'm not even adding sprites to the new group. Just adding the group causes the crash.Got absolutely no idea on what may be causing this. Is there a group limit? I don't think 5 groups is too much, is it? Link to comment Share on other sites More sharing options...
rich Posted January 19, 2014 Share Posted January 19, 2014 I suspect it's the fact the new group is empty that is causing it. Pretty sure this is fixed in 1.1.4 already, but in the meantime try adding just one sprite and see what happens. Link to comment Share on other sites More sharing options...
mariogarranz Posted January 19, 2014 Author Share Posted January 19, 2014 You were right Rich. As always, thank you very much for your excelent support. Link to comment Share on other sites More sharing options...
Recommended Posts