void ProcessInput() { if (!player.GetAnyButton()) { playerRigidBody.velocity = Vector2.zero; } Vector2 totalVelocity = new Vector2(); if (upPressed) { totalVelocity += (Vector2.up * playerSpeed); } else if (downPressed) { totalVelocity += (Vector2.down * playerSpeed); } if (leftPressed) { totalVelocity += (Vector2.left * playerSpeed); } else if (rightPressed) { totalVelocity += (Vector2.right * playerSpeed); } playerRigidBody.velocity = totalVelocity; }