programlocura Posted February 3, 2014 Share Posted February 3, 2014 (edited) Hi! I'm currently working on a game and i came across with a problem. Today i was merging new changes into the project and the collisions stop working... The changes were:Add audio/musicDelete some commentsChange minor thingsI'm managing the collisions this way:this.physics.collide( this.player, this.zombies, this.collisionHandler, null, this);The collision handler:/** * Manage the collision between the player and the enemies * @param obj1 PhaserSprite * @param obj2 PhaserGroup * @returns void */collisionHandler : function( obj1, obj2 ) { /* console.clear(); console.log("%c-- Colision Between Player And Zombie --", "color: red; font-size: 18px"); console.debug(obj1); console.debug(obj2); */ if( obj2.type === 'zombie' ) { // Games end this.gameEnded = true; // Stoping zombies for( var i = 0; i < this.zombiesCount; i++ ) { var currZombie = this.zombiesManager[i].spr; if( currZombie ) { currZombie.body.velocity.x = 0; currZombie.body.velocity.y = 0; } } // Calling Game over this.onGameover(); }},I don't even know how to start debugging this error. The dev console doesn't show the collision or errors.Is there any reported bug where the collisions suddenly stop working? Overlap isn't working either I can't figure out why the collisions are deactivated... this.zombies.forEach(function(collectible){ if(this.game.physics.overlap(this.player,collectible)) { this.collisionHandler(this.player, collectible); }}); Thanks in advance. Edited February 3, 2014 by programlocura Nebulocity 1 Link to comment Share on other sites More sharing options...
programlocura Posted February 4, 2014 Author Share Posted February 4, 2014 Hi!I finally solved the problem, i was overrading the type of one sprite:this.doorMask.type = 'door'; // Now is commented to prevent thisThis line was preventing Phaser to detect the collisions. Thanks to everyone! Link to comment Share on other sites More sharing options...
Recommended Posts