本文整理汇总了C++中Sprite3D::runAction方法的典型用法代码示例。如果您正苦于以下问题:C++ Sprite3D::runAction方法的具体用法?C++ Sprite3D::runAction怎么用?C++ Sprite3D::runAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprite3D
的用法示例。
在下文中一共展示了Sprite3D::runAction方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
bool LoadingLayer::init()
{
if(!LayerColor::init())
return false;
//Set the background color
LoadingLayer::setColor(Color3B::WHITE);
Size visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
Vec2 centerPoint = Utils::Utils::getCentralPoint(visibleSize, origin);
//Load a planet sprite to show while the game loads
Sprite3D* sprPlanet = Sprite3D::create("3d/meshes/MarsPlanet.obj", "3d/textures/MarsMap.jpg");
sprPlanet->setPosition(centerPoint);
Utils::Utils::setScale3D(10, sprPlanet);
sprPlanet->runAction(RepeatForever::create(RotateBy::create(3,Vec3(0,360,0))));
//Load the sprite with "LOADING..." string while the game loads
Text* loadingText = Text::create("LOADING...", DEFAULT_FONT, 34);
loadingText->setPosition(Vec2(sprPlanet->getPositionX(), SCREEN_FRAME_OFFSET));
//Add elements as layer children
addChild(sprPlanet);
addChild(loadingText);
return true;
}
示例2:
Sprite3D *MySprite3DFactory::create(cocos2d::MySpriteType type)
{
Sprite3D *sp = Sprite3D::create(m_ModelFilesOfType[type]);
if(sp)
{
sp->setAnchorPoint(Vec2(0, 1));
sp->runAction(getAction(type));
}
return sp;
}
示例3: eye
//.........这里部分代码省略.........
auto LightMapScene = Sprite3D::create(fileName);
LightMapScene->setScale(8);
addChild(LightMapScene, 100 + i, 100 + i);
LightMapScene->setRotation3D(Vec3(0, 180, 0));
auto sc = LightMapScene->getScale();
auto sz = LightMapScene->getContentSize();
auto curY = _terrain->getHeight(Vec2(250 + i*(sc*sz.width - 150), 10));
LightMapScene->setPosition3D(Vec3(250 + i*(sc*sz.width - 150), curY, 10));
}
for (int i = 0; i < 14; ++i)
{
auto LightMapScene = Sprite3D::create(fileName);
LightMapScene->setScale(8);
addChild(LightMapScene, 200 + i, 200 + i);
LightMapScene->setRotation3D(Vec3(0, 0, 0));
auto sc = LightMapScene->getScale();
auto sz = LightMapScene->getContentSize();
auto curY = _terrain->getHeight(Vec2(250 + i*(sc*sz.width - 150), -1500));
LightMapScene->setPosition3D(Vec3(250 + i*(sc*sz.width - 150), curY, -1500));
}
for (int i = 0; i < 14; ++i)
{
auto LightMapScene = Sprite3D::create(fileName);
LightMapScene->setScale(8);
addChild(LightMapScene, 300 + i, 300 + i);
LightMapScene->setRotation3D(Vec3(0, 90, 0));
auto sc = LightMapScene->getScale();
auto sz = LightMapScene->getContentSize();
auto curY = _terrain->getHeight(Vec2(20, -400 - i * 80));
LightMapScene->setPosition3D(Vec3(20, curY, -400 - i * 80));
}
for (int i = 0; i < 14; ++i)
{
auto LightMapScene = Sprite3D::create(fileName);
LightMapScene->setScale(8);
addChild(LightMapScene, 400 + i, 400 + i);
LightMapScene->setRotation3D(Vec3(0, 270, 0));
auto sc = LightMapScene->getScale();
auto sz = LightMapScene->getContentSize();
auto curY = _terrain->getHeight(Vec2(1200, -400 - i * 80));
LightMapScene->setPosition3D(Vec3(1200, curY, -400 - i * 80));
}
//for (int i = 0; i < 10; ++i)
//{
// auto LightMapScene = Sprite3D::create(fileName);
// LightMapScene->setScale(8);
// addChild(LightMapScene, i, i);
// LightMapScene->setRotation3D(Vec3(90, 180, 0));
// auto sc = LightMapScene->getScale();
// auto sz = LightMapScene->getContentSize();
// CCLOG("getContentSize().width = %f, getContentSize().height = %f",
// getContentSize().width, getContentSize().height);
// LightMapScene->setPosition3D(Vec3(200 + i*(sc*sz.width - 150), 100, -300));
//}
Sprite3D* temp = (Sprite3D*)getChildByTag(100 + 13);
CCLOG("getPositionX() = %f, getPositionY() = %f, getPositionZ = %f",
temp->getPositionX(), temp->getPositionY(), temp->getPositionZ());
CCLOG("getScaleX() = %f, getScaleX() = %f, getScaleZ = %f",
temp->getScaleX(), temp->getScaleY(), temp->getScaleZ());
CCLOG("getContentSize().width = %f, getContentSize().height = %f",
temp->getContentSize().width, temp->getContentSize().height);
CCLOG("getAnchorPoint().x = %f, getAnchorPoint().y = %f",
temp->getAnchorPoint().x, temp->getAnchorPoint().y);
//actions
temp->runAction(Sequence::create(
DelayTime::create(2),
CCMoveBy::create(0.5, Vec3(0, 100, 0)),
CCMoveTo::create(1, Vec3(500, _terrain->getHeight(500, -500), -500)),
nullptr));
temp->runAction(Sequence::create(
DelayTime::create(2.5),
CCRotateBy::create(1, Vec3(90, 0, 0)),
nullptr));
// actions
_camera->runAction(Sequence::create(
DelayTime::create(5),
MoveBy::create(3, Vec3(0, 0, -1300)),
CallFunc::create([=](){
for (int i = 0; i < 14; ++i)
{
Sprite3D* temp = (Sprite3D*)getChildByTag(200 + i);
temp->runAction(Sequence::create(
RotateTo::create(0.5, Vec3(90, 0, 0)),
nullptr));
}
}),
nullptr));
}