1

I have a sprite in scene1.m and I have a button in HUD layer hud.m. Now a button appears in Scene1.

How can I get control of scene1 sprite from HUD layer. Any ideas?

4

1 に答える 1

0

With cocos2d, you can assign a tag to your sprite (or button, or any class derived from CCNode), and to each of its hierarchy of parents (see CCNode class, setTag() ). You can then use these tags to retrieve the corresponding nodes from anywhere in your code, with CCNode getChildByTag().

于 2012-06-25T00:27:19.980 に答える