Jump to content

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


tonky
 Share

Recommended Posts

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

 

    resetGame: function(a, b, f1, f2, begin){
        if (!begin) {
            return;
        }
        if (begin) {        
            if (SideScroller.TRIES_LEFT === 0) {
                console.log('over');
            } 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

 Share

  • Recently Browsing   0 members

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