当前位置: 首页>>代码示例>>C++>>正文


C++ ActionTimeline::play方法代码示例

本文整理汇总了C++中ActionTimeline::play方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionTimeline::play方法的具体用法?C++ ActionTimeline::play怎么用?C++ ActionTimeline::play使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ActionTimeline的用法示例。


在下文中一共展示了ActionTimeline::play方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: animateHitPiece

void MainScene::animateHitPiece(Side obstacleSide)
{
    Piece* flyingPiece = dynamic_cast<Piece*>(CSLoader::createNode("Piece.csb"));
    ActionTimeline* pieceTimeline = CSLoader::createTimeline("Piece.csb");
    
    flyingPiece->setObstacleSide(obstacleSide);
    flyingPiece->setPosition(this->flyingPiecePosition);
    
    this->addChild(flyingPiece);
    this->runAction(pieceTimeline);
    
    switch (this->character->getSide()) {
        case Side::Left:
            pieceTimeline->play("moveRight", false);
            break;
        case Side::Right:
            pieceTimeline->play("moveLeft", false);
            break;
        default:
            break;
    }
    
    // on the last frame of the animation, remove the piece from the scene
    pieceTimeline->setLastFrameCallFunc([this, &flyingPiece]() {
        this->removeChild(flyingPiece);
    });
    
}
开发者ID:adizdar,项目名称:cocosGameDemo,代码行数:28,代码来源:MainScene.cpp

示例2: triggerActionTimeline

void MainScene::triggerActionTimeline(string animationName, bool loop)
{
    // we pass "MainScene.csb" to the constructor
    // so this ActionTimeline will be able to play any of the animations
    // that we've created in MainScene.csd
    ActionTimeline* timeline = CSLoader::createTimeline("MainScene.csb");
    ERROR_HANDLING(timeline);
    
    //this->stopAllActions(); // cancel any currently running actions on MainScene
    this->runAction(timeline); // we tell MainScene to run the timeline
    timeline->play(animationName, loop);
    
}
开发者ID:adizdar,项目名称:cocosGameDemo,代码行数:13,代码来源:MainScene.cpp

示例3: onEnter

// TestTimelineAnimationList
void TestTimelineAnimationList::onEnter()
{
    ActionTimelineBaseTest::onEnter();
    Node* node = CSLoader::createNode("ActionTimeline/DemoPlayer.csb");
    ActionTimeline* action = CSLoader::createTimeline("ActionTimeline/DemoPlayer.csb");
    cocostudio::timeline::AnimationInfo standinfo("stand", 0, 40);
    cocostudio::timeline::AnimationInfo walkinfo("walk", 41, 81);
    action->addAnimationInfo(standinfo);
    action->addAnimationInfo(walkinfo);
    node->runAction(action);
    action->play("walk", true);

    node->setScale(0.2f);
    node->setPosition(150,100);
    addChild(node);
}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例4: createSkin

void ScenePlot::createSkin()
{
	auto skin = CSLoader::createNode(RES_MODULES_PLOT_SCENE_PLOT_CSB);
	addChild(skin);

	auto layoutBg = (Layout *)skin->getChildByName("layoutBg");
	layoutBg->addTouchEventListener([=](Ref *ref, Widget::TouchEventType type)
	{
		if (type == Widget::TouchEventType::ENDED)
		{
			ActionTimeline *actionTimeline = (ActionTimeline *)skin->getActionByTag(skin->getTag());
			if (actionTimeline == nullptr)
			{
				actionTimeline = CSLoader::createTimeline(RES_MODULES_PLOT_SCENE_PLOT_CSB);
				skin->runAction(actionTimeline);
			}

			auto animationName = "animation" + Value(_countClickCurr).asString();

			auto isAnimationInfoExists = actionTimeline->IsAnimationInfoExists(animationName);
			if (!isAnimationInfoExists)
			{
				ManagerData::getInstance()->setSaveFileExist();
				ManagerUI::getInstance()->replaceScene(TypeScene::MAIN);
				return;
			}

			if (_isPlaying)
			{
				return;
			}
			_isPlaying = true;

			actionTimeline->play(animationName, false);
			actionTimeline->setLastFrameCallFunc([=]()
			{
				_isPlaying = false;
			});

			_countClickCurr++;
		}
	});
}
开发者ID:capricemz,项目名称:LL,代码行数:43,代码来源:ScenePlot.cpp


注:本文中的ActionTimeline::play方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。