LoginSignup
6
7

More than 5 years have passed since last update.

Sprite を階層的にしてみる

Last updated at Posted at 2014-08-31

cocos2d-x v3 の Sprite クラス は Node クラスの派生クラスなので、addChild() により階層化することが出来るぞ。

auto sprite = Sprite::create("hoge.png");
addChild(sprite);
auto child = Sprite::create("hoge2.png");
sprite->addChild(child);

このように階層化しておくと、MoveBy などで親ノードを移動すると、子ノードもいっしょに移動してくれるぞ。
ただし、FadeOut で親ノードをフェイドアウトしても、個ノードもフェイドアウトはしてくれないようだ。

ちなみに、子ノードの座標系原点は親ノード左下点のようだ

6
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
7