<commit_before>var Player = function (parent, x, y) {
	this.parent = parent;
	this.sprite;
	this.x = x;
	this.y = y;
	this.width = 25;
	this.height = 40;
	this.inventory = 0;
	this.canJump = false;
	
	this.INVENTORY_CAP = 5;
	this.SPEED = 300;
	this.JUMP = -450;
	
	this.create();
}

Player.prototype = {
	create: function () {
		// create player
		var graphics = game.add.graphics(0, 0);
		
		graphics.beginFill(0x333333);
		graphics.drawRect(0, 0, this.width, this.height);
		
		this.sprite = game.add.sprite(this.x, this.y, graphics.generateTexture());
		graphics.destroy();
		
		// enable physics
		game.physics.p2.enable(this.sprite);
		
		// player physics settings
		this.sprite.body.mass = 1;
		
		this.sprite.body.setCollisionGroup(this.parent.playerCollisionGroup);
	},
	update: function () {
		this.sprite.body.setZeroRotation();
		this.sprite.body.rotation = 0;
		
		this.move();
	},
	move: function () {
		// move left and right
		if(game.input.keyboard.isDown(Phaser.Keyboard.A)
		  || game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
			this.sprite.body.velocity.x = -this.SPEED;
		}
		else if(game.input.keyboard.isDown(Phaser.Keyboard.D)
			   || game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
			this.sprite.body.velocity.x = this.SPEED;
		}
		
		// jump
		if((game.input.keyboard.isDown(Phaser.Keyboard.W)
		  || game.input.keyboard.isDown(Phaser.Keyboard.UP))
		  && this.canJump) {
			this.sprite.body.velocity.y = this.JUMP;
			this.canJump = false;
		}
	},
	moveToStart: function (x, y) {
		this.sprite.body.x = x;
		this.sprite.body.y = y;
		
		this.sprite.body.velocity.x = 0;
		this.sprite.body.velocity.y = 0;
	},
	checkJump: function () {
		this.canJump = true;
	}
}<commit_msg>Fixes #13<commit_after>var Player = function (parent, x, y) {
	this.parent = parent;
	this.sprite;
	this.x = x;
	this.y = y;
	this.width = 25;
	this.height = 40;
	this.inventory = 0;
	this.canJump = false;
	this.jumpKeyUp = false;
	
	this.INVENTORY_CAP = 5;
	this.SPEED = 300;
	this.JUMP = -450;
	
	this.create();
}

Player.prototype = {
	create: function () {
		// create player
		var graphics = game.add.graphics(0, 0);
		
		graphics.beginFill(0x333333);
		graphics.drawRect(0, 0, this.width, this.height);
		
		this.sprite = game.add.sprite(this.x, this.y, graphics.generateTexture());
		graphics.destroy();
		
		// enable physics
		game.physics.p2.enable(this.sprite);
		
		// player physics settings
		this.sprite.body.mass = 1;
		
		this.sprite.body.setCollisionGroup(this.parent.playerCollisionGroup);
	},
	update: function () {
		this.sprite.body.setZeroRotation();
		this.sprite.body.rotation = 0;
		
		this.move();
		
		// reset jump if key is up
		if(!game.input.keyboard.isDown(Phaser.Keyboard.W)
		   && !game.input.keyboard.isDown(Phaser.Keyboard.UP)) {
			this.jumpKeyUp = true;
		}
		else {
			this.jumpKeyUp = false;
		}
	},
	move: function () {
		// move left and right
		if(game.input.keyboard.isDown(Phaser.Keyboard.A)
		  || game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
			this.sprite.body.velocity.x = -this.SPEED;
		}
		else if(game.input.keyboard.isDown(Phaser.Keyboard.D)
			   || game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
			this.sprite.body.velocity.x = this.SPEED;
		}
		
		// jump
		if((game.input.keyboard.isDown(Phaser.Keyboard.W)
		  || game.input.keyboard.isDown(Phaser.Keyboard.UP))
		  && this.canJump
		  && this.jumpKeyUp) {
			this.sprite.body.velocity.y = this.JUMP;
			this.canJump = false;
		}
	},
	moveToStart: function (x, y) {
		this.sprite.body.x = x;
		this.sprite.body.y = y;
		
		this.sprite.body.velocity.x = 0;
		this.sprite.body.velocity.y = 0;
	},
	checkJump: function () {
		// allow another jump if the jump key is no longer down
		this.canJump = true;
	}
}
{'fraction_non_alphanumeric': 0.15998931623931623, 'fraction_numerical': 0.015491452991452992, 'mean_word_length': 3.1018619934282583, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '1951565', 'n_tokens_mistral': 1660, 'n_tokens_neox': 1448, 'n_words': 230}