iDevGames Forums
Depth Sorting - Printable Version

+- iDevGames Forums (
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: iPhone, iPad & iPod Game Development (/forum-11.html)
+--- Thread: Depth Sorting (/thread-8203.html)

Depth Sorting - marzdh - Oct 13, 2010 02:00 AM


I'm new to iPhone game development and have a question related to depth sorting.

Basically I'm developing a 2D game which requires using the z-axis. The game is an isometric game with multiple objects on screen..some further away in distance and some nearer. The objects keep shifting in their z-axis, so objects which are behind come in front and objects which are in front go behind. This requires depth sorting of objects.

I have been suggested to use UIImageViews in my game, and to modify the layering of the UIImageview in order to sort out depth issue.

I have tried using insert subview method to change the layering of the UIImageView object but no luck.

Is there another way to work with depth sorting.


RE: Depth Sorting - jSTIN - Nov 4, 2010 09:34 AM

If you are using UIImageView, simply do this.

myImageView.layer.zPosition = 10;

The higher numbers will be drawn on top.