src/games/snakeGame/level1/services/logic.js
/** 
    this will listen to gesture event (if game is being played in mobiles)
    */
this will listen to gesture event (if game is being played in mobiles)
this will listen to gesture event ( if game is being played in mobiles )
gestureHandler(evt) {
        var gestureCode = globalGestureHandler(evt, this.touchCordinates);
        if (this.gamePlaying) {
            switch (gestureCode) {
                case 1:
                    if (this.dir !== "right") {
                        this.dir = "left";
                        this.left.play();
                    }
                    break;
                case 2:
                    if (this.dir !== "left") {
                        this.dir = "right";
                        this.right.play();
                    }
                    break;
                case 3:
                    if (this.dir !== "up") {
                        this.dir = "down";
                        this.up.play();
                    }
                    break;
                case 4:
                    if (this.dir !== "down") {
                        this.dir = "up";
                        this.down.play();
                    }
                    break;
                default:
                    break;
            }
        }
    }
gestureHandler ( evt ) { var gestureCode = globalGestureHandler ( evt , this . touchCordinates ) ; if ( this . gamePlaying ) { switch ( gestureCode ) { case 1 : if ( this . dir !== "right" ) { this . dir = "left" ; this . left . play ( ) ; } break ; case 2 : if ( this . dir !== "left" ) { this . dir = "right" ; this . right . play ( ) ; } break ; case 3 : if ( this . dir !== "up" ) { this . dir = "down" ; this . up . play ( ) ; } break ; case 4 : if ( this . dir !== "down" ) { this . dir = "up" ; this . down . play ( ) ; } break ; default : break ; } } }
this will listen to gesture event (if game is being played in mobiles)
this will listen to gesture event ( if game is being played in mobiles )