comeBackAt(x, y) {
        let head = this.head()
        head.x = x
        head.y = y
        // Stack other body's tiles together
        // They would be resolved in subsequent moves by move() function
        for (var i = 1; i < this.snake_body.length - 1; i++) {
            this.snake_body[i].x = x - this.dx * this.step()
            this.snake_body[i].y = y - this.dy * this.step()
        }
    }
/**
     * Reset head position for snake to come back to canvas
     */
Reset head position for snake to come back to canvas
Reset head position for snake to come back to canvas
comeBackAt(x, y) {
        let head = this.head()
        head.x = x
        head.y = y
        for (var i = 1; i < this.snake_body.length - 1; i++) {
            this.snake_body[i].x = x - this.dx * this.step()
            this.snake_body[i].y = y - this.dy * this.step()
        }
    }
comeBackAt ( x , y ) { let head = this . head ( ) head . x = x head . y = y for ( var i = 1 ; i < this . snake_body . length - 1 ; i ++ ) { this . snake_body [ i ] . x = x - this . dx * this . step ( ) this . snake_body [ i ] . y = y - this . dy * this . step ( ) } }
Reset head position for snake to come back to canvas
Reset head position for snake to come back to canvas
// Stack other body's tiles together // They would be resolved in subsequent moves by move() function