Jump to content

box2d plugin: callbacks are running several times even if only checking for 'begin'


Recommended Posts

    this.head.body.setBodyContactCallback(this.groundBody, this.resetGame, this);


    resetGame: function(a, b, f1, f2, begin){
        if (!begin) {
        if (begin) {        
            if (SideScroller.TRIES_LEFT === 0) {
            } else {            
                console.log('tries not zero');

The code in reset() is running multiple times. So for example, I get                 

console.log('tries not zero');

in console, 3 or 5 times instead of just once. 

How can I fix this pls? 



Link to comment
Share on other sites


  • Recently Browsing   0 members

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