1st you need them all in 1 big family or multiple families grouped under one main family if that is even possible...
after that u compare Y and Z order them if Y is less or higher than bbox top/bboxbottom of the player ( keep in mind, that the bbox alters based on collision mask "rectangle" even tho u have a shape based collision mask... the bbox is measuring just the corners of ur collision mask)
i think there might be a Construct 2 or Construct classic tutorial on this... it's in the forum for sure ... but forgot how was called... maybe search for Z sorting by Y or something like that
however this sorting is going to raise ur CPU usage since u calculate everytick each sprite position relative to player position, instead of doing that i would just move the players Z instead based on relative position of other walls/trees/enemies triggered by 1 time instead of everytick.