示例#1
0
void SpeedTest::onEnter()
{
	EaseSpriteDemo::onEnter();

	// rotate and jump
	CCActionInterval *jump1 = CCJumpBy::actionWithDuration(4, CCPointMake(-400,0), 100, 4);
	CCActionInterval *jump2 = jump1->reverse();
	CCActionInterval *rot1 = CCRotateBy::actionWithDuration(4, 360*2);
	CCActionInterval *rot2 = rot1->reverse();
	
	CCFiniteTimeAction* seq3_1 = CCSequence::actions(jump2, jump1, NULL);
	CCFiniteTimeAction* seq3_2 = CCSequence::actions( rot1, rot2, NULL);
	CCFiniteTimeAction* spawn = CCSpawn::actions(seq3_1, seq3_2, NULL);
	CCSpeed* action = CCSpeed::actionWithAction(CCRepeatForever::actionWithAction((CCActionInterval*)spawn), 1.0f);
	action->setTag(kTagAction1);
	
	CCAction* action2 = (CCAction*)(action->copy()->autorelease());
	CCAction* action3 = (CCAction*)(action->copy()->autorelease());

	action2->setTag(kTagAction1);
	action3->setTag(kTagAction1);
	
	m_grossini->runAction( action2 );
	m_tamara->runAction( action3 );
	m_kathia->runAction( action );
	
	this->schedule(schedule_selector(SpeedTest::altertime), 1.0f);//:@selector(altertime:) interval:1.0f];
}
示例#2
0
void SpeedTest::onEnter()
{
    EaseSpriteDemo::onEnter();
    
    CCSize s = CCDirector::sharedDirector()->getWinSize();

    // rotate and jump
    CCActionInterval *jump1 = CCJumpBy::create(4, ccp(-s.width+80, 0), 100, 4);
    CCActionInterval *jump2 = jump1->reverse();
    CCActionInterval *rot1 = CCRotateBy::create(4, 360*2);
    CCActionInterval *rot2 = rot1->reverse();
    
    CCSequence* seq3_1 = CCSequence::create(jump2, jump1, NULL);
    CCSequence* seq3_2 = CCSequence::create( rot1, rot2, NULL);
    CCSpawn* spawn = CCSpawn::create(seq3_1, seq3_2, NULL);
    CCSpeed* action = CCSpeed::create(CCRepeatForever::create(spawn), 1.0f);
    action->setTag(kTagAction1);
    
    CCAction* action2 = (CCAction*)(action->copy()->autorelease());
    CCAction* action3 = (CCAction*)(action->copy()->autorelease());

    action2->setTag(kTagAction1);
    action3->setTag(kTagAction1);
    
    m_grossini->runAction(action2);
    m_tamara->runAction(action3);
    m_kathia->runAction(action);
    
    this->schedule(schedule_selector(SpeedTest::altertime), 1.0f);//:@selector(altertime:) interval:1.0f];
}
KDvoid SpeedTest::onEnter ( KDvoid )
{
	TestEaseActions::onEnter ( );

    CCSize s = this->getContentSize ( );

    // rotate and jump
    CCActionInterval *jump1 = CCJumpBy::create(4, ccp(-s.cx+80, 0), 100, 4);
    CCActionInterval *jump2 = jump1->reverse();
    CCActionInterval *rot1 = CCRotateBy::create(4, 360*2);
    CCActionInterval *rot2 = rot1->reverse();
    
    CCSequence* seq3_1 = CCSequence::create(jump2, jump1, KD_NULL);
    CCSequence* seq3_2 = CCSequence::create( rot1, rot2, KD_NULL);
    CCSpawn* spawn = CCSpawn::create(seq3_1, seq3_2, KD_NULL);
    CCSpeed* action = CCSpeed::create(CCRepeatForever::create ( spawn), 1.0f);
    action->setTag(kTagAction1);
    
    CCAction* action2 = (CCAction*)(action->copy()->autorelease( ) );
    CCAction* action3 = (CCAction*)(action->copy()->autorelease( ) );

    action2->setTag(kTagAction1);
    action3->setTag(kTagAction1);
    
    m_grossini->runAction(action2);
    m_tamara->runAction(action3);
    m_kathia->runAction(action);
    
    this->schedule(schedule_selector(SpeedTest::altertime), 1.0f);
}