Jump to content

Detect end of collision


P4nch0
 Share

Recommended Posts

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
   }
}

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...