Boxtufty Posted April 25, 2014 Share Posted April 25, 2014 Simple check solved it, sorry for excellent thread. Remove if you like.Scenario: I have two entities, when they overlap a handler function executes it's statements. Problem: This collision handler keeps getting called every tick for the duration that the entities are overlapping. I only want it to call once, and then chill out. Mindless rambling: I think this is a matter of logic, like a simple boolean check should solve it. edit: Yep. Quote Link to comment Share on other sites More sharing options...
Boxtufty Posted April 25, 2014 Author Share Posted April 25, 2014 // on creationentity.colliding = false; // in collision handlerif(!entity.colliding){dostuff;colliding = true;} Quote Link to comment Share on other sites More sharing options...
Vaughan Posted April 25, 2014 Share Posted April 25, 2014 Typically, you solve this by just simply setting a 'overlapped' flag that gets reset as soon as they're NOT overlapping and set when they overlap. Quote Link to comment Share on other sites More sharing options...
mraak Posted April 26, 2014 Share Posted April 26, 2014 Would be great to have this overlapped flag built into Ph. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.