examples/whack-a-mole/js/entities/entities.js
function() {
        if (this.isOut === true) {
            this.isOut = false;
            // set touch animation
            this.setCurrentAnimation("touch", this.hide.bind(this));
            // make it flicker
            this.flicker(750);
            // play ow FX
            me.audio.play("ow");

            // add some points
            game.data.score += 100;

            if (game.data.hiscore < game.data.score) {
                // i could save direclty to me.save
                // but that allows me to only have one
                // simple HUD Score Object
                game.data.hiscore = game.data.score;
                // save to local storage
                me.save.hiscore = game.data.hiscore;
            }

            // stop propagating the event
            return false;

        }
    }
function() {
        if (this.isOut === true) {
            this.isOut = false;
            // set touch animation
            this.setCurrentAnimation("touch", this.hide.bind(this));
            // make it flicker
            this.flicker(750);
            // play ow FX
            me.audio.play("ow");

            // add some points
            game.data.score += 100;

            if (game.data.hiscore < game.data.score) {
                // i could save direclty to me.save
                // but that allows me to only have one
                // simple HUD Score Object
                game.data.hiscore = game.data.score;
                // save to local storage
                me.save.hiscore = game.data.hiscore;
            }

            // stop propagating the event
            return false;

        }
    }
function ( ) { if ( this . isOut === true ) { this . isOut = false ; // set touch animation this . setCurrentAnimation ( "touch" , this . hide . bind ( this ) ) ; // make it flicker this . flicker ( 750 ) ; // play ow FX me . audio . play ( "ow" ) ; // add some points game . data . score += 100 ; if ( game . data . hiscore < game . data . score ) { // i could save direclty to me.save // but that allows me to only have one // simple HUD Score Object game . data . hiscore = game . data . score ; // save to local storage me . save . hiscore = game . data . hiscore ; } // stop propagating the event return false ; } }
callback for mouse click
callback for mouse click