@Salodo Thanks a lot!
I forgot to mention that I need to change the sprite color on hover. After your answer, I came up with the idea of how to google the question and I found a solution on reddit. I wrote a function where I use the GetIndex() method: "I managed to do it, by keeping track of all the sprites that can be highlighted and then doing a first pass to checking the highest z_index or child_index."