objective c - How to get position of sprite with a particular tag in Xcode? -


I'm new to XCode and Obj-C, so please forgive me if I'm pretty clear here.

I have a project in which I create a Sprite by calling this editorial function:

  CCSprite * _tree = [CCSprite spriteWithFile: @ "tree.png"]; [Self combine: _tree z: -1 tag: i]; If (i == 0) {_tree.position = CCP (100, 100); } And if (i> gt;) {_tree.position = CCP (tree with i-1 tag) +20, 100); }  

So I call this function using an update method:

  - (zero) add: (ccTime) dt {[self AddTree]; I ++; }  

In this way, each tree that is born will have more number of tags than the last number. The first tree is grown at 100,100

How do I prepare the next tree before the tree's X position (i-1) plus 20? And is there an easy way to do this?

  CCSprocess * tree = (CCSP) * [self attainment childbat: I - 1 + 20] ; // or any integer CGPoint position = tree.position;  

I hope that you find me right. Note that getChildByTag returns zero if there is no child with any such tag


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -