P4nch0 Posted March 19, 2016 Share Posted March 19, 2016 Hi, Has anyone have good ide how to detect end of collision beetwen player and object? Now i am detecting when position player x - possition objext x is higher than.. Maybe someone have better, please write Link to comment Share on other sites More sharing options...
Cudabear Posted March 20, 2016 Share Posted March 20, 2016 Arcade physics collisions return true if the collision has occurred, and false if it hasn't. You can use this to determine the first frame where the collision stops happening. Something like this: var collisionHappenedLastFrame; if(game.physics.arcade.collide(entity1, entity2)){ collisionHappenedLastFrame = true; }else{ if(collisionHappenedLastFrame){ collisionHappenedLastFrame = false; //here's your code that relies on the collision ending } } P4nch0 1 Link to comment Share on other sites More sharing options...
P4nch0 Posted March 21, 2016 Author Share Posted March 21, 2016 Hi, I will try this method, thanks Link to comment Share on other sites More sharing options...
Recommended Posts