andreasp1994 Posted August 19, 2016 Share Posted August 19, 2016 Hey guys, I am seeking some help on how to execute a collision callback only once. I am creating an asteroids game, but when the spacecraft collides with the asteroid the callback executes continuously. I would like to execute the call back only once while the collision is happening and re enable it when they stop colliding. Is there a way to trigger a callback when the collision stops ?? Any help is appreciated. Thanks Link to comment Share on other sites More sharing options...
samme Posted August 20, 2016 Share Posted August 20, 2016 Are you using arcade.collide or arcade.overlap? collide should separate the two bodies so they collide for only 1 frame. For arcade.overlap, Phaser doesn't trigger anything when the overlap ends, but you can track it yourself with body.touching.none and body.wasTouching.none. Link to comment Share on other sites More sharing options...
andreasp1994 Posted August 22, 2016 Author Share Posted August 22, 2016 I am using arcade.collide, but they collide continuously rather than just 1 frame. I will try body.touching.none and body.wasTouching.none in conjunction with arcade.collide to see if its working... Thanks for your help! Link to comment Share on other sites More sharing options...
Recommended Posts