(t) //tRotation(20) // Gets the spriteA's transform.t = spriteA.nodeToParentTransform() // Sets the additional transform to spriteB, spriteB's rotation will based on its pseudo parent i.e. (t) //tScale(2) // Gets the spriteA's transform.t = spriteA.nodeToParentTransform() // Sets the additional transform to spriteB, spriteB's scale will based on its pseudo parent i.e. So just add it to layer.// But we want to simulate `parent-child` relationship for these two (spriteB) //tPosition(ccp(200, 200)) // Gets the spriteA's transform.var t = spriteA.nodeToParentTransform() // Sets the additional transform to spriteB, spriteB's postion will based on its pseudo parent i.e. create a batchNodevar batch= cc.SpriteBatchNode.create("Icon-114.png") this.addChild(batch) // create two sprites, spriteA will be added to batchNode, they are using different textures.var spriteA = cc.Sprite.createWithTexture(batch->getTexture()) var spriteB = cc.Sprite.create("Icon-72.png") batch.addChild(spriteA) // We can't make spriteB as spriteA's child since they use different textures. It could be used to simulate `parent-child` relationship between two nodes (e.g. ![]() The additional transform will be concatenated at the end of nodeToParentTransform. # The grid will render the captured screen // examplecc.Sprite = cc.Node.extend( # The node will be moved according to the camera values (camera) Order in transformations with grid enabled # The node will be translated (position) Order in transformations with grid disabled create callbacks to handle the advancement of time overriding init to initialize resources and schedule callbacks Subclassing a cc.Node usually means (one/all) of: Some cc.Node nodes provide extra functionality for them or their children. They can execute actions (runAction, stopAction, etc) They can schedule periodic callback (schedule, unschedule, etc) They can contain other cc.Node nodes (addChild, getChildByTag, removeChild, etc) The most popular cc.Nodes are: cc.Scene, cc.Layer, cc.Sprite, cc.Menu. Anything thats gets drawn or contains things that get drawn is a cc.Node.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |