本文整理汇总了C++中CCJumpBy类的典型用法代码示例。如果您正苦于以下问题:C++ CCJumpBy类的具体用法?C++ CCJumpBy怎么用?C++ CCJumpBy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCJumpBy类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CCJumpBy
//
// JumpBy
//
CCJumpBy* CCJumpBy::actionWithDuration(ccTime duration, const CCPoint& position, ccTime height, unsigned int jumps)
{
CCJumpBy *pJumpBy = new CCJumpBy();
pJumpBy->initWithDuration(duration, position, height, jumps);
pJumpBy->autorelease();
return pJumpBy;
}
示例2: CCJumpBy
//
// JumpBy
//
CCJumpBy* CCJumpBy::actionWithDuration(cocos2d::ccTime duration, cocos2d::CGPoint position, cocos2d::ccTime height, int jumps)
{
CCJumpBy *pJumpBy = new CCJumpBy();
pJumpBy->initWithDuration(duration, position, height, jumps);
pJumpBy->autorelease();
return pJumpBy;
}
示例3: CCJumpBy
//
// JumpBy
//
CCJumpBy* CCJumpBy::create(float duration, const CCPoint& position, float height, unsigned int jumps)
{
CCJumpBy *pJumpBy = new CCJumpBy();
pJumpBy->initWithDuration(duration, position, height, jumps);
pJumpBy->autorelease();
return pJumpBy;
}
示例4: CCPointMake
IntervalLayer::IntervalLayer()
{
m_time0 = m_time1 = m_time2 = m_time3 = m_time4 = 0.0f;
CCSize s = CCDirector::sharedDirector()->getWinSize();
// sun
CCParticleSystem* sun = CCParticleSun::node();
sun->setTexture(CCTextureCache::sharedTextureCache()->addImage("Images/fire.png"));
sun->setPosition( CCPointMake(s.width-32,s.height-32) );
sun->setTotalParticles(130);
sun->setLife(0.6f);
this->addChild(sun);
// timers
m_label0 = CCLabelBMFont::labelWithString("0", "fonts/bitmapFontTest4.fnt");
m_label1 = CCLabelBMFont::labelWithString("0", "fonts/bitmapFontTest4.fnt");
m_label2 = CCLabelBMFont::labelWithString("0", "fonts/bitmapFontTest4.fnt");
m_label3 = CCLabelBMFont::labelWithString("0", "fonts/bitmapFontTest4.fnt");
m_label4 = CCLabelBMFont::labelWithString("0", "fonts/bitmapFontTest4.fnt");
scheduleUpdate();
schedule(schedule_selector(IntervalLayer::step1));
schedule(schedule_selector(IntervalLayer::step2), 0);
schedule(schedule_selector(IntervalLayer::step3), 1.0f);
schedule(schedule_selector(IntervalLayer::step4), 2.0f);
m_label0->setPosition(CCPointMake(s.width*1/6, s.height/2));
m_label1->setPosition(CCPointMake(s.width*2/6, s.height/2));
m_label2->setPosition(CCPointMake(s.width*3/6, s.height/2));
m_label3->setPosition(CCPointMake(s.width*4/6, s.height/2));
m_label4->setPosition(CCPointMake(s.width*5/6, s.height/2));
addChild(m_label0);
addChild(m_label1);
addChild(m_label2);
addChild(m_label3);
addChild(m_label4);
// Sprite
CCSprite* sprite = CCSprite::spriteWithFile(s_pPathGrossini);
sprite->setPosition( CCPointMake(40,50) );
CCJumpBy* jump = CCJumpBy::actionWithDuration(3, CCPointMake(s.width-80,0), 50, 4);
addChild(sprite);
sprite->runAction( CCRepeatForever::actionWithAction(
(CCActionInterval*)(CCSequence::actions(jump, jump->reverse(), NULL ))
)
);
// pause button
CCMenuItem* item1 = CCMenuItemFont::itemFromString("Pause", this, menu_selector(IntervalLayer::onPause) );
CCMenu* menu = CCMenu::menuWithItems(item1, NULL);
menu->setPosition( CCPointMake(s.width/2, s.height-50) );
addChild( menu );
}
示例5: menu_selector
//------------------------------------------------------------------
//
// MenuLayer3
//
//------------------------------------------------------------------
MenuLayer3::MenuLayer3()
{
CCMenuItemFont::setFontName("Marker Felt");
CCMenuItemFont::setFontSize(28);
CCLabelBMFont* label = CCLabelBMFont::create("Enable AtlasItem", "fonts/bitmapFontTest3.fnt");
CCMenuItemLabel* item1 = CCMenuItemLabel::create(label, this, menu_selector(MenuLayer3::menuCallback2) );
CCMenuItemFont* item2 = CCMenuItemFont::create("--- Go Back ---", this, menu_selector(MenuLayer3::menuCallback) );
CCSprite *spriteNormal = CCSprite::create(s_MenuItem, CCRectMake(0,23*2,115,23));
CCSprite *spriteSelected = CCSprite::create(s_MenuItem, CCRectMake(0,23*1,115,23));
CCSprite *spriteDisabled = CCSprite::create(s_MenuItem, CCRectMake(0,23*0,115,23));
CCMenuItemSprite* item3 = CCMenuItemSprite::create(spriteNormal, spriteSelected, spriteDisabled, this, menu_selector(MenuLayer3::menuCallback3));
m_disabledItem = item3; item3->retain();
m_disabledItem->setEnabled( false );
CCMenu *menu = CCMenu::create( item1, item2, item3, NULL);
menu->setPosition( CCPointMake(0,0) );
CCSize s = CCDirector::sharedDirector()->getWinSize();
item1->setPosition( CCPointMake(s.width/2 - 150, s.height/2) );
item2->setPosition( CCPointMake(s.width/2 - 200, s.height/2) );
item3->setPosition( CCPointMake(s.width/2, s.height/2 - 100) );
CCJumpBy* jump = CCJumpBy::create(3, CCPointMake(400,0), 50, 4);
item2->runAction( CCRepeatForever::create(
(CCActionInterval*)(CCSequence::create( jump, jump->reverse(), NULL))
)
);
CCActionInterval* spin1 = CCRotateBy::create(3, 360);
CCActionInterval* spin2 = (CCActionInterval*)(spin1->copy()->autorelease());
CCActionInterval* spin3 = (CCActionInterval*)(spin1->copy()->autorelease());
item1->runAction( CCRepeatForever::create(spin1) );
item2->runAction( CCRepeatForever::create(spin2) );
item3->runAction( CCRepeatForever::create(spin3) );
addChild( menu );
menu->setPosition(ccp(0,0));
}