examples/whack-a-mole/js/entities/entities.js
function ( dt )
    {
        if (this.isVisible) {
            // call the super function to manage animation
            this._super(me.Sprite, "update", [dt] );

            // hide the mode after 1/2 sec
            if (this.isOut===true) {
                this.timer += dt;
                if ((this.timer) >= 500) {
                    this.isOut = false;
                    // set default one
                    this.setCurrentAnimation("laugh");
                    this.hide();
                    // play laugh FX
                    //me.audio.play("laugh");

                    // decrease score by 25 pts
                    game.data.score -= 25;
                    if (game.data.score < 0) {
                        game.data.score = 0;

                    }
                }
                return true;
            }
        }
        return this.isVisible;
    }
function ( dt )
    {
        if (this.isVisible) {
            // call the super function to manage animation
            this._super(me.Sprite, "update", [dt] );

            // hide the mode after 1/2 sec
            if (this.isOut===true) {
                this.timer += dt;
                if ((this.timer) >= 500) {
                    this.isOut = false;
                    // set default one
                    this.setCurrentAnimation("laugh");
                    this.hide();
                    // play laugh FX
                    //me.audio.play("laugh");

                    // decrease score by 25 pts
                    game.data.score -= 25;
                    if (game.data.score < 0) {
                        game.data.score = 0;

                    }
                }
                return true;
            }
        }
        return this.isVisible;
    }
function ( dt ) { if ( this . isVisible ) { // call the super function to manage animation this . _super ( me . Sprite , "update" , [ dt ] ) ; // hide the mode after 1/2 sec if ( this . isOut === true ) { this . timer += dt ; if ( ( this . timer ) >= 500 ) { this . isOut = false ; // set default one this . setCurrentAnimation ( "laugh" ) ; this . hide ( ) ; // play laugh FX //me.audio.play("laugh"); // decrease score by 25 pts game . data . score -= 25 ; if ( game . data . score < 0 ) { game . data . score = 0 ; } } return true ; } } return this . isVisible ; }
update the mole
update the mole