<commit_before>var right = false, left = false, up = false, down = false;
window.addEventListener("keydown", function(e) {
	switch(e.keyCode) {
		case 40:
			down = true;
			break;
		case 39:
			right = true;
			break;
		case 38:
			up = true;
			break;
		case 37:
			left = true;
			break;
	}
});
window.addEventListener("keyup", function(e) {
	switch(e.keyCode) {
		case 40:
			down = false;
			break;
		case 39:
			right = false;
			break;
		case 38:
			up = false;
			break;
		case 37:
			left = false;
			break;
	}
})



var testPlayer = {
	positionX: 193,
	positionY: 140,
	width: 35,
	height: 60,
	hp: 100,
	money: 50,
	update: function(game) {
		if(right) {
			game.offsetX += 3;
		}
		if(left) {
			game.offsetX -= 3;
		}
		if(up) {
			game.offsetY += 3;
		}
		if(down) {
			game.offsetY -= 3;
		}

		if(game.offsetX < 0) {game.offsetX = 0;}
		if(game.offsetY < 0) {game.offsetY = 0;}
	},
	damage: function(damage) {
		if(testPlayer.hp - damage > 0){
			testPlayer.hp -= damage;
		}
		else{
			//Player is killed
		}
	},
	draw: function(d) {
		d.fillStyle("#000000").fillRect(0, 0, 35, 60);
	}
}<commit_msg>Some tweaks<commit_after>var right = false, left = false, up = false, down = false;
window.addEventListener("keydown", function(e) {
	switch(e.keyCode) {
		case 40:
			down = true;
			break;
		case 39:
			right = true;
			break;
		case 38:
			up = true;
			break;
		case 37:
			left = true;
			break;
	}
});
window.addEventListener("keyup", function(e) {
	switch(e.keyCode) {
		case 40:
			down = false;
			break;
		case 39:
			right = false;
			break;
		case 38:
			up = false;
			break;
		case 37:
			left = false;
			break;
	}
})



var testPlayer = {
	positionX: 193,
	positionY: 140,
	width: 35,
	height: 60,
	hp: 100,
	money: 50,
	update: function(game) {
		if(right) {
			game.offsetX += 3;
		}
		if(left) {
			game.offsetX -= 3;
		}
		if(up) {
			game.offsetY += 3;
		}
		if(down) {
			game.offsetY -= 3;
		}

		if(game.offsetX < 0) {game.offsetX = 0;}
		if(game.offsetY < 0) {game.offsetY = 0;}
	},
	damage: function(damage) {
		if(testPlayer.hp - damage > 0){
			testPlayer.hp -= damage;
		}
		else{
			//Player is killed
			alert("Game Over!");
		}
	},
	draw: function(d) {
		d.fillStyle("#000000").fillRect(0, 0, 35, 60);
	}
}
{'fraction_non_alphanumeric': 0.16592724046140195, 'fraction_numerical': 0.04614019520851819, 'mean_word_length': 2.585055643879173, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '7278285', 'n_tokens_mistral': 1170, 'n_tokens_neox': 924, 'n_words': 219}