<commit_before>"use strict";

function ControlInterfacePlayer( entity )
{
	this.entity = entity;
	this.screen = entity.screen;
}

ControlInterfacePlayer.prototype.update =
	function()
	{

	};

ControlInterfacePlayer.prototype.getMovementDirection =
	function()
	{
		var movementDirection = new Vec2(0, 0);

		var key = this.screen.game.key;
		if(key.isDown(key.UP) || key.isDown(key.W))
			movementDirection.y += -1;
		if(key.isDown(key.DOWN) || key.isDown(key.S))
			movementDirection.y += 1;
		if(key.isDown(key.LEFT) || key.isDown(key.A))
			movementDirection.x += -1;
		if(key.isDown(key.RIGHT) || key.isDown(key.D))
			movementDirection.x += 1;

		return movementDirection;
	};

ControlInterfacePlayer.prototype.getTurretDirection =
	function()
	{
		var direction = this.screen.game.mouse.position.Subv(this.entity.position);
		return direction.normalise();
	};

ControlInterfacePlayer.prototype.isTryingToFire =
	function()
	{
		var mouse = this.screen.game.mouse;
		var isPressing = mouse.isDown(mouse.LEFT);
		if(isPressing)
		{
			mouse.debounce(mouse.LEFT);
			return true;
		}
		return false;
	};<commit_msg>Fixed use of canvas-space mouse position to orient the turret.<commit_after>"use strict";

function ControlInterfacePlayer( entity )
{
	this.entity = entity;
	this.screen = entity.screen;
}

ControlInterfacePlayer.prototype.update =
	function()
	{

	};

ControlInterfacePlayer.prototype.getMovementDirection =
	function()
	{
		var movementDirection = new Vec2(0, 0);

		var key = this.screen.game.key;
		if(key.isDown(key.UP) || key.isDown(key.W))
			movementDirection.y += -1;
		if(key.isDown(key.DOWN) || key.isDown(key.S))
			movementDirection.y += 1;
		if(key.isDown(key.LEFT) || key.isDown(key.A))
			movementDirection.x += -1;
		if(key.isDown(key.RIGHT) || key.isDown(key.D))
			movementDirection.x += 1;

		return movementDirection;
	};

ControlInterfacePlayer.prototype.getTurretDirection =
	function()
	{
		var worldSpaceCursor = Game.canvasToWorld(this.screen.game.mouse.position);
		var direction = worldSpaceCursor.Subv(this.entity.position);
		return direction.normalise();
	};

ControlInterfacePlayer.prototype.isTryingToFire =
	function()
	{
		var mouse = this.screen.game.mouse;
		var isPressing = mouse.isDown(mouse.LEFT);
		if(isPressing)
		{
			mouse.debounce(mouse.LEFT);
			return true;
		}
		return false;
	};
{'fraction_non_alphanumeric': 0.14170212765957446, 'fraction_numerical': 0.005957446808510639, 'mean_word_length': 4.306997742663657, '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': '5602102', 'n_tokens_mistral': 889, 'n_tokens_neox': 819, 'n_words': 132}