If you have multiple chests, then I think you need to pick the correct chest first, for example closest to the player or overlapping the player. Something like this:
Chest Pick Nearest to (player.x, player.y)
player.y<Chest.y Player Move behind Chest
player.y>Chest.y Player Move in front Chest[/code:1drgypec]
And, of course, both the player and the chest should be on the same layer.