Cocos2d に 2 つの CCNode があり、互いに同期して動的にスケーリングしたいと考えています。どちらの CCNode もバックグラウンド ノードです。視覚的に、1 つの CCNode である NodeA は、他の CCNode である NodeB よりも y 方向で上にあります。しかし、以下のコードのように両方のノードを同時にスケーリングすると:
編集 #1 -
ノード B は CCLayer、HUDLayer の一部です。HUDLayer はスケーリングしませんが、HUDLayer の NodeB はスケーリングします。コードは次のようになります
NodeA.anchorPoint = ccp(0.5f, 0.0f);
NodeA.scale = scale;
HUDLayer.NodeB.anchorPoint = ccp(0.5f, 0.0f);
HUDLayer.NodeB.scale = scale;
4) Would NodeB being part of a CCLayer effect the Nodes scaled relative positions?
編集の終了 #1
編集#2
The contentSize of CCNode is (0,0). How do I set the contentSize of CCNode manually?
編集の終了 #2
編集 #3
答えの1つがCCNodeのrelativeToAnchorPointプロパティをYESに設定することについて話しているこの投稿を見つけました。Googleでこれを行う方法が見つかりません。relativeToAnchorPoint を設定する方法を知っている人はいますか?
編集の終了 #3
NodeA は、y 方向で NodeB の下に落ちます。したがって、これによりいくつかの質問が生じます。
1) Are CCNodes scaled with respect to an anchorPoint?
2) Why is NodeA dropping below NodeB in the y direction?
3) How can two CCNodes be scaled with their relative positions remaining constant?