Player sprite sinks into colliders

I’ve got a scene there there are 3 layers of 30 objects, each with their own box colliders. The way the “game” works atm is when the player presses A S or D if the sprite is next to a object, the “digs” through and removes it. The issue comes in when the sprite is on the second layer and trying to dig through the sides of an object. The sprite seems to sink into one of the objects below and destroys them instead

I’ll link a video to show it in action, maybe it will be easier to see it happening: Desktop 2018 04 30 20 52 54 04 - YouTube

If anyone can suggest possible solutions, that would be great

EDIT:

Player movement

void Update () {
		float axisX = Input.GetAxis ("Horizontal");
		float axisY = Input.GetAxis ("Vertical");

		transform.Translate (new Vector3 (axisX, axisY) * Time.deltaTime * speed); 
            //Speed is set to 10
	}

Object removal

void OnCollisionStay2D(Collision2D collStay)
	{
		if (isTriggered == false && Input.GetKey ("s")){
			countDown -= Time.deltaTime;
			print (countDown);
			if (countDown <= 0) {
				dirtCount = dirtCount + 1;
				print (dirtCount);
				Destroy (collStay.gameObject);
				countDown = 2.0f;
			}
		}

		if (enteredBlockSide == true && Input.GetKey ("d")){
			countDown -= Time.deltaTime;
			print (countDown);
			if (countDown <= 0) {
				dirtCount = dirtCount + 1;
				print (dirtCount);
				Destroy (collStay.gameObject);
				countDown = 2.0f;
			}
		}

		if (enteredBlockSide == true && Input.GetKey ("a")){
			countDown -= Time.deltaTime;
			print (countDown);
			if (countDown <= 0) {
				dirtCount = dirtCount + 1;
				print (dirtCount);
				Destroy (collStay.gameObject);
				countDown = 2.0f;
			}
		}
	}

isTriggered is there to stop removal of 2 objects at once.
enteredBlockSide is a Linecast which I was hoping would solve my issue (it didn’t).

Great, thanks for providing code and explanation.

I think what happens is that OnCollisionStay2D() for the block in the lower layer is executed before it is executed for the upper layer, so it gets destroyed, then countDown is already > 0 (if it is static variable or in the same script) so it doesn’t destroy the current layer. I’m not sure why the line cast doesn’t help, but it must be true for both blocks. Is enteredBlockSide a static variable or in the same script?

I’m not sure if you have this logic on the player or on the blocks (both can make sense), but I would put it on the blocks, but set in the player the block being dug (with the Linecast from the centre of the player, ignoring the player’s layer), and then check if this block is the same as the player has selected. Does this make sense?

Also, as your player object has a collider, I would suggest to not move it by transform.Translate(), but by rigidbody.MovePosition(). See the answer to this question for why (aside that it is better performance-wise).

Btw, you could move the repetitive if (countDown <= 0) part into a separate function (for example you could call it Dig()), so that if you want to change it you only need to do it in one place.