本文整理汇总了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));
}
示例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);
}
示例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;
}
示例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;
}