function hitByGhost(){
    _pwac.setAttribute('position', '0 0 0');
    if(_lives >= 1){
        _lives--;
        document.querySelector('#lives').setAttribute('src', '#l'+_lives);
        document.querySelector('#lostLife').emit('lostlifeMax');
        document.querySelector('#lostLife').emit('lostlifeMin');
        console.log('lives: ' + _lives);
    }else{
        document.querySelector('#gameOver').emit('enterGo');
        console.log('Game Over');
    }
    //cleans invisible crumbs
    var eatenCrumbs = document.querySelectorAll('[visible=false]');
}
//When collides with ghost you loose a turn!
When collides with ghost you loose a turn!
When collides with ghost you loose a turn!
function hitByGhost(){
    _pwac.setAttribute('position', '0 0 0');
    if(_lives >= 1){
        _lives--;
        document.querySelector('#lives').setAttribute('src', '#l'+_lives);
        document.querySelector('#lostLife').emit('lostlifeMax');
        document.querySelector('#lostLife').emit('lostlifeMin');
        console.log('lives: ' + _lives);
    }else{
        document.querySelector('#gameOver').emit('enterGo');
        console.log('Game Over');
    }
    var eatenCrumbs = document.querySelectorAll('[visible=false]');
}
function hitByGhost ( ) { _pwac . setAttribute ( 'position' , '0 0 0' ) ; if ( _lives >= 1 ) { _lives -- ; document . querySelector ( '#lives' ) . setAttribute ( 'src' , '#l' + _lives ) ; document . querySelector ( '#lostLife' ) . emit ( 'lostlifeMax' ) ; document . querySelector ( '#lostLife' ) . emit ( 'lostlifeMin' ) ; console . log ( 'lives: ' + _lives ) ; } else { document . querySelector ( '#gameOver' ) . emit ( 'enterGo' ) ; console . log ( 'Game Over' ) ; } var eatenCrumbs = document . querySelectorAll ( '[visible=false]' ) ; }
When collides with ghost you loose a turn!
When collides with ghost you loose a turn!
//cleans invisible crumbs