Moving Character in Time to a Direction.

Hi All,

I’m trying to build a simple game, where player collect coins.

What i couldn’t make work is to move the player x position with a key press in time and with limit.

Like the image below, i want to move the player to right when a key pressed. and if the player is at that point, there must be no way to move in that direction again.

I need the move with a speed, and if any key is pressed while moving, nothing should be happened.

What i’m trying and not working is ;

		// Variables

		private float	
			moveSpeedRL;
	
		private float
			movePointA;
		private float
		
			movePointB;
		private float
			movePointC;
	
		private bool
			isMovingRL = false;
		moveSpeedRL = 1.0f;
		movePointA = 1.0f;
		movePointB = 0f;
		movePointC = -1.0f;

		if (Input.GetKeyDown("a"))
			m_player.transform.Translate(Vector3.right + movePointA);

		if (Input.GetKeyDown("d"))
			m_player.transform.Translate(Vector3.right + movePointC);

		if (isMovingRL = true)
			// ??????????????

I need the move in a time to a spesific position with a limitation and disable the buttons while the move like the image below.

I’m not suprised that it did not work based on my low experience on scripting, but i will be really happy, if you guys give me a hand on this. :neutral:

1243183--53172--$A.jpg

1243183--53172--$A.jpg

Please give me some help about this.

Thanks…