3 spites in the same array: collision

Hi. I have 3 sprites(2 rectangles and another - the player -). All three are in the same table of sprites (myarray). I need to do this:

  1. The player (color = 0x00FF0f) comes out push red rectangles in all 4 directions.
  2. I would like that when the two rectangles are colliding horizontally, the player can’t push horizontally.
    If the two rectangles colliding vertically, the player can"t push vertically.

Thank you kindly help me.
My project is here. https://www.dropbox.com/s/9vzlvcprtcjg1va/CoolCollision.rar?dl=0

Sorry for my english.