js/MainScene.js
/**
     *  Update the scene frame by frame, responsible for move and rotate the bird and to create and move the pipes.
     */
Update the scene frame by frame, responsible for move and rotate the bird and to create and move the pipes.
Update the scene frame by frame responsible for move and rotate the bird and to create and move the pipes .
update() {
        this.getParams(true);
        if (this.inScene) {
            this.balloons.getChildren().forEach(function (balloon) {
                if (balloon) {
                    balloon.body.gravity.y = this.gravity;
                    balloon.setScale(this.scaleBalloon);
                    if (this.choice == 'balloons') {
                        balloon.setFrame(this.color);
                    }
                }
                if (balloon.body.y < -this.game.scale.gameSize.height * 0.1) {
                    if (balloon.frame.name == this.color && this.choice == 'colors') {
                        this.lifesLosts++;
                        this.errorSound.play();
                    }
                    balloon.destroy();
                }
            }, this);
        }
        document.getElementById('chanceDisplay').innerHTML = this.life - this.lifesLosts;
        this.gameOver();
    }
update ( ) { this . getParams ( true ) ; if ( this . inScene ) { this . balloons . getChildren ( ) . forEach ( function ( balloon ) { if ( balloon ) { balloon . body . gravity . y = this . gravity ; balloon . setScale ( this . scaleBalloon ) ; if ( this . choice == 'balloons' ) { balloon . setFrame ( this . color ) ; } } if ( balloon . body . y < - this . game . scale . gameSize . height * 0.1 ) { if ( balloon . frame . name == this . color && this . choice == 'colors' ) { this . lifesLosts ++ ; this . errorSound . play ( ) ; } balloon . destroy ( ) ; } } , this ) ; } document . getElementById ( 'chanceDisplay' ) . innerHTML = this . life - this . lifesLosts ; this . gameOver ( ) ; }
Update the scene frame by frame, responsible for move and rotate the bird and to create and move the pipes.
Update the scene frame by frame responsible for move and rotate the bird and to create and move the pipes .
// Update params // This function can also be called if we are not in the scene when need to if we are in the de enter in loop // Update actual this.balloons // Destroy balloons of range // Update chance display div // Check if game over