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


C++ CCArmature::setPosition方法代码示例

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


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

示例1: RunAction

void PlayScene::RunAction(CCPoint pos, const char* name) {
  CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("Action/Action.ExportJson");
  CCArmature *armature = CCArmature::create("Action");
  armature->getAnimation()->play(name);
  armature->setPosition(pos);
  this->addChild(armature, 2, 102);
  armature->getAnimation()->setMovementEventCallFunc(this,movementEvent_selector(PlayScene::ArmatureCallBack));
}
开发者ID:f17qh,项目名称:crazyass,代码行数:8,代码来源:play_scene.cpp

示例2: onEnter

void TestDirectLoading::onEnter()
{
    ArmatureTestLayer::onEnter();

    // remove sigle resource
    CCArmatureDataManager::sharedArmatureDataManager()->removeArmatureFileInfo("armature/bear.ExportJson");

    // load resource directly
    CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("armature/bear.ExportJson");

    CCArmature *armature = CCArmature::create("bear");
    armature->getAnimation()->playByIndex(0);
    armature->setPosition(ccp(VisibleRect::center().x, VisibleRect::center().y));
    addChild(armature);
}
开发者ID:76299500,项目名称:cocos2d-x,代码行数:15,代码来源:ArmatureScene.cpp

示例3: init

// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }
    
    CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
    CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();

    /////////////////////////////
    // 2. add a menu item with "X" image, which is clicked to quit the program
    //    you may modify it.

    // add a "close" icon to exit the progress. it's an autorelease object
    CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
                                        "CloseNormal.png",
                                        "CloseSelected.png",
                                        this,
                                        menu_selector(HelloWorld::menuCloseCallback));
    
	pCloseItem->setPosition(ccp(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 ,
                                origin.y + pCloseItem->getContentSize().height/2));

    // create menu, it's an autorelease object
    CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
    pMenu->setPosition(CCPointZero);
    this->addChild(pMenu, 1);

    /////////////////////////////
    // 3. add your codes below...
	
	CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("hero/Hero.ExportJson");
	CCArmature* armature = CCArmature::create("Hero");
	armature->getAnimation()->play("attack");
	armature->setScale(1.5);
	armature->setPosition(ccp(visibleSize.width*0.25, visibleSize.height*0.25));

	addChild(armature);
    
    return true;
}
开发者ID:253627764,项目名称:CocoStudioSamples,代码行数:45,代码来源:HelloWorldScene.cpp

示例4: init

bool MainMenuScene::init()
{    
	menuLayer = CCLayer::create();
    CCSize size = CCDirector::sharedDirector()->getWinSize();
    
    // Add backgrounbdPic
    CCSprite* backGroundPic = CCSprite::create("pictures/mainMenuBackGround.png");
    backGroundPic->setAnchorPoint(ccp(0, 0));
    
    menuLayer->addChild(backGroundPic,0);
	
	// Add ChenXiaoG welcome armature
	CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("animations/ChenXiaoGeWelcome.ExportJson");
	CCArmature *armature = CCArmature::create("ChenXiaoGeWelcome");
	armature->getAnimation()->play("Animation1");
	armature->getAnimation()->setSpeedScale(1.5f);
	armature->setAnchorPoint(ccp(0,0));
	armature->setPosition(ccp(size.width/8, size.height/6));
	armature->setScale(0.5);
	menuLayer->addChild(armature,1);

    
    //Add StartBtn
    CCSprite* start     = CCSprite::create("pictures/startbtn.png");
    CCSprite* startPush = CCSprite::create("pictures/startbtnPush.png");
    
    CCMenuItemSprite * startBtn = CCMenuItemSprite::create(start, startPush, this, menu_selector(MainMenuScene::startBtnCallFunc));
    
    //Add Menu
    mainMenu = CCMenu::create(startBtn, NULL);
    mainMenu->setAnchorPoint(ccp(0, 0));
    mainMenu->setPosition(ccp(size.width/6, size.height/1.3));
    menuLayer->addChild(mainMenu,2);

	//Add snow particle
	CCParticleSystem *particle = CCParticleSnow::create();
	particle->setTexture(CCTextureCache::sharedTextureCache()->addImage("pictures/snow.png"));
	menuLayer->addChild(particle,3);

    this->addChild(menuLayer ,0);

    return true;
}
开发者ID:RaoZiJian,项目名称:ParkourSample,代码行数:43,代码来源:MainMenuScene.cpp


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