dist/server-module/lance-gg.js
// check if pair (id1, id2) have collided
check if pair (id1, id2) have collided
check if pair ( id1 id2 ) have collided
checkPair(id1, id2) {
        let objects = this.gameEngine.world.objects;
        let o1 = objects[id1];
        let o2 = objects[id2];
        if (!o1 || !o2) return;
        let pairId = [id1, id2].join(',');
        if (this.findCollision(o1, o2)) {
            if (!(pairId in this.collisionPairs)) {
                this.collisionPairs[pairId] = true;
                this.gameEngine.emit('collisionStart', { o1, o2 });
            }
        } else if (pairId in this.collisionPairs) {
            this.gameEngine.emit('collisionStop', { o1, o2 });
            delete this.collisionPairs[pairId];
        }
    }
checkPair ( id1 , id2 ) { let objects = this . gameEngine . world . objects ; let o1 = objects [ id1 ] ; let o2 = objects [ id2 ] ; if ( ! o1 || ! o2 ) return ; let pairId = [ id1 , id2 ] . join ( ',' ) ; if ( this . findCollision ( o1 , o2 ) ) { if ( ! ( pairId in this . collisionPairs ) ) { this . collisionPairs [ pairId ] = true ; this . gameEngine . emit ( 'collisionStart' , { o1 , o2 } ) ; } } else if ( pairId in this . collisionPairs ) { this . gameEngine . emit ( 'collisionStop' , { o1 , o2 } ) ; delete this . collisionPairs [ pairId ] ; } }
check if pair (id1, id2) have collided
check if pair ( id1 id2 ) have collided
// make sure that objects actually exist. might have been destroyed