Get Updates By E-mail 

Article Written By:
Johann Dowa

Handling Z-Ordering In Cocos2D Map Based Games

  •  
  •  
  •  
  •  
  •  

If you’ve used Cocos2D for awhile you may have had some difficult when trying to handle the display order of images.

Things get even more complicated if you are creating an isometric game.  The player character may need to be placed behind an obstacle such as a rock or a tree.  In v0.99.1 automatic z-ordering for tile maps was implemented, and the problem was somewhat solved, but some problems still exist and there is some tweaking to be done.

Another problem, especially with map-based games is creating a player HUD display as the images need to be placed at the right z-ordering and at a consistent location on the screen.

Nat Weiss has created a tutorial on how to overcome these problems by creating two different custom sprite classes which can be found here:
CCZSprite and HudLevelSprite

These two classes should be of help to anyone interested in creating a map-based game in Cocos2D.

Thanks for reading, if you like this please share it!


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments