<commit_before>(function() {
    'use strict';

    /**
     * Reference file: https://github.com/photonstorm/phaser-examples/blob/master/projects/rox/src/Player.js
     */

    var textureKey = 'player1';
    var maxSpeed = 500;
    var fullJumpMeter = 500;
    var acc = 2000;
    var maxJumps = 2;
    var maxVelocity = new Phaser.Point(500, 0);

    Game.Player = function(game, x, y) {

        Phaser.Sprite.call(this, game, x, y, textureKey);

        this.anchor.set(0.5);
        this.game.physics.enable(this, Phaser.Physics.ARCADE);

        this.body.collideWorldBounds = true;
        this.body.drag.setTo(1000, 0);

        this.controller = new Game.Controller(this.game);

        this.animations.add('running', [5, 6, 7, 8, 9, 10, 11, 12], 10, true);
        this.animations.add('jump', [3], 20, true);
        this.animations.add('falling', [2], 20, true);
        this.animations.add('still', [1], 20, true);

        this.currAnim = '';

        this.jumpMeter = fullJumpMeter;
        this.currentJumps = 0;

        this.ctrlKey = this.game.input.keyboard.addKey(17);

        return this;
    };

    // Clone the Phaser.Sprite prototype, and use it as our own. 
    // This is how inheritance works in JavaScript btw
    Game.Player.prototype = Object.create(Phaser.Sprite.prototype);
    Game.Player.prototype.constructor = Game.Player;

    Game.Player.prototype.resetJump = function() {
        this.currentJumps = 0;
        this.jumpMeter = fullJumpMeter;
    };

    Game.Player.prototype.jump = function() {
        if (this.controller.jump.isDown) {
            if (!this.jumpWasDown) {
                this.currentJumps += 1;

                if (this.currentJumps < maxJumps && this.body.velocity.y > 0) {
                    this.body.velocity.y = 0;
                }
            }

            if (this.jumpMeter > 0 && this.currentJumps < maxJumps) {
                this.body.velocity.y -= this.jumpMeter;
                this.jumpMeter *= 0.5;

                this.animations.play('jump');
            }
        } else {
            if (this.jumpWasDown) {
                if (maxJumps !== this.currentJumps) {
                    this.jumpMeter = fullJumpMeter;
                } else {
                    this.jumpMeter = 0;
                }
            }
        }


        // if (this.controller.jump.isDown && this.jumpMeter > 0 && this.currentJumps !== maxJumps) {
        //     this.jumpMeter += jumpAcc;
        //     this.body.velocity.y += jumpAcc;
        //     this.currentJumps += 1;

        //     this.animations.play('jump');
        // } else if (!this.controller.jump.isDown && !(this.body.onFloor() || this.body.touching.down)) {
        //     if (maxJumps !== this.currentJumps) {
        //         this.jumpMeter = fullJumpMeter;
        //     } else {
        //         this.jumpMeter = 0;
        //     }
        // }

        this.jumpWasDown = this.controller.jump.isDown;
    };

    Game.Player.prototype.animate = function() {
        if (this.controller.right.isDown || this.controller.left.isDown) {
            this.animations.play('running');
        }

        if (this.body.velocity.y > 0 && !this.body.onFloor()) {
            this.animations.play('falling');
        }

        if ((this.body.touching.down || this.body.onFloor()) && Math.abs(this.body.velocity.x) < 40) {
            this.animations.play('still');
        }
    };

    Game.Player.prototype.update = function() {
        if (this.controller.right.isDown) {
            this.body.acceleration.x = acc;<commit_msg>Removed old, commented, code<commit_after>(function() {
    'use strict';

    /**
     * Reference file: https://github.com/photonstorm/phaser-examples/blob/master/projects/rox/src/Player.js
     */

    var textureKey = 'player1';
    var maxSpeed = 500;
    var fullJumpMeter = 500;
    var acc = 2000;
    var maxJumps = 2;
    var maxVelocity = new Phaser.Point(500, 0);

    Game.Player = function(game, x, y) {

        Phaser.Sprite.call(this, game, x, y, textureKey);

        this.anchor.set(0.5);
        this.game.physics.enable(this, Phaser.Physics.ARCADE);

        this.body.collideWorldBounds = true;
        this.body.drag.setTo(1000, 0);

        this.controller = new Game.Controller(this.game);

        this.animations.add('running', [5, 6, 7, 8, 9, 10, 11, 12], 10, true);
        this.animations.add('jump', [3], 20, true);
        this.animations.add('falling', [2], 20, true);
        this.animations.add('still', [1], 20, true);

        this.currAnim = '';

        this.jumpMeter = fullJumpMeter;
        this.currentJumps = 0;

        this.ctrlKey = this.game.input.keyboard.addKey(17);

        return this;
    };

    // Clone the Phaser.Sprite prototype, and use it as our own. 
    // This is how inheritance works in JavaScript btw
    Game.Player.prototype = Object.create(Phaser.Sprite.prototype);
    Game.Player.prototype.constructor = Game.Player;

    Game.Player.prototype.resetJump = function() {
        this.currentJumps = 0;
        this.jumpMeter = fullJumpMeter;
    };

    Game.Player.prototype.jump = function() {
        if (this.controller.jump.isDown) {
            if (!this.jumpWasDown) {
                this.currentJumps += 1;

                if (this.currentJumps < maxJumps && this.body.velocity.y > 0) {
                    this.body.velocity.y = 0;
                }
            }

            if (this.jumpMeter > 0 && this.currentJumps < maxJumps) {
                this.body.velocity.y -= this.jumpMeter;
                this.jumpMeter *= 0.5;

                this.animations.play('jump');
            }
        } else {
            if (this.jumpWasDown) {
                if (maxJumps !== this.currentJumps) {
                    this.jumpMeter = fullJumpMeter;
                } else {
                    this.jumpMeter = 0;
                }
            }
        }

        this.jumpWasDown = this.controller.jump.isDown;
    };

    Game.Player.prototype.animate = function() {
        if (this.controller.right.isDown || this.controller.left.isDown) {
            this.animations.play('running');
        }

        if (this.body.velocity.y > 0 && !this.body.onFloor()) {
            this.animations.play('falling');
        }

        if ((this.body.touching.down || this.body.onFloor()) && Math.abs(this.body.velocity.x) < 40) {
            this.animations.play('still');
        }
    };

    Game.Player.prototype.update = function() {
        if (this.controller.right.isDown) {
            this.body.acceleration.x = acc;
{'fraction_non_alphanumeric': 0.14120511259890445, 'fraction_numerical': 0.018411442483262326, 'mean_word_length': 1.7828111769686705, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '492130', 'n_tokens_mistral': 2258, 'n_tokens_neox': 2024, 'n_words': 360}