hierarchy in a group

Hi,

I am creating a game in 2D, there is a map and there is object who move on it. 

I would like

if(object.y>object1.y)then

object come behind obect1 

end

I don’t know how to do that.

But i have some idea

groupy={}

globalgroup= display.newGroup()

for i=1,1000,1 do

globalgroup:insert( groupy[i] )

end

groupy[object.y]=object

groupy[object1.y]=object1

to apply this idea i have problem because my object move on the map and i don’t know how to remove the object of the group and don’t destroy it in the same time for after that to reinsert the object to another place in the group.

If you have another idea to do that do not hesitate to write an answer.

thank you in advance

Here’s some discussion on z-axis/z-depth sorting when working with Corona SDK:

http://forums.coronalabs.com/topic/48103-isometric-depth-sorting-in-corona/

Here’s some discussion on z-axis/z-depth sorting when working with Corona SDK:

http://forums.coronalabs.com/topic/48103-isometric-depth-sorting-in-corona/