Last active
August 29, 2015 14:01
-
-
Save kyokomi/5a2db065d52539ba94bf to your computer and use it in GitHub Desktop.
Cocos2d-x3.0のrotation3Dで奥に移動する感じのやつ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add "HelloWorld" splash screen" | |
auto sprite = Sprite::create("HelloWorld.png"); | |
sprite->setRotation3D(cocos2d::Vertex3F(-80.0, 0.0, 0.0)); | |
// positionZのMoveToとかないのか。。。 | |
sprite->runAction(RepeatForever::create(Sequence::create(DelayTime::create(0.2f), CallFunc::create([sprite]() { | |
sprite->setPositionZ(sprite->getPositionZ()-10); | |
}), NULL))); | |
auto miniSprite = Sprite::create("HelloWorld.png"); | |
miniSprite->setScale(0.5f); | |
miniSprite->setPosition(sprite->getContentSize().width/2, sprite->getContentSize().height/2); | |
sprite->addChild(miniSprite); | |
// position the sprite on the center of the screen | |
sprite->setPosition(Point(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y)); | |
// add the sprite as a child to this layer | |
this->addChild(sprite, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment