Subscribe to web2feel.com
Subscribe to web2feel.com

Welcome to My Website

ShaTechs... Technology at your reach...

Layers in cocos2D

Posted by shajir Tuesday, June 7, 2011

A CCLayer has a size of the whole drawable area, and knows how to draw itself. It can be semi transparent (having holes and/or partial transparency in some/all places), allowing to see other layers behind it. Layers are the ones defining appearance and behavior, so most of your programming time will be spent coding CCLayer subclasses that do what you need.

The CCLayer is where you define event handlers. Events are propagated to layers (from front to back) until some layer catches the event and accepts it. 
Although some serious apps will require you to define custom CCLayer classes, cocos2d provides a library of useful predefined layers (a simple menu layer: CCMenu, a color layer: CCColorLayer, a multiplexor between other layers: CCMultiplexLayer, and more ).
Layers can contain CCSprite objects, CCLabel objects and even other CCLayer objects as children.
Since layers are subclass of CCNode, they can be transformed manually or by using actions. See Actions for more detail about actions.

0 comments

Post a Comment

Search This Blog