Пример #1
0
void MainLayer::playDropAnimation()
{
	CCSprite *left = (CCSprite*) this->getChildByTag(TAG_LEFT);
	CCSprite *right = (CCSprite*) this->getChildByTag(TAG_RIGHT);
	/*-- 走路动画 --*/
	left->stopAllActions();
	right->stopAllActions();
	CCPoint la = left->getAnchorPoint();
	CCPoint ra = right->getAnchorPoint();
	left->initWithSpriteFrameName("ultraman_big_19.png");
	right->initWithSpriteFrameName("dragon_big_19.png");
	left->setAnchorPoint(la);
	right->setAnchorPoint(ra);

	CCSize vsize = CCDirector::sharedDirector()->getVisibleSize();
	float width = vsize.width / 2;
	float height = vsize.height / 2;
	left->runAction(
			CCMoveTo::create(0.6f,
					ccp(left->getPositionX(),
							-height - left->getContentSize().height)));
	right->runAction(
			CCMoveTo::create(0.6f,
					ccp(right->getPositionX(),
							-height - right->getContentSize().height)));
	CCPoint p = (left->getPosition() + ccp(0, left->getContentSize().height / 2)
			+ right->getPosition() + ccp(0, right->getContentSize().height / 2))
			/ 2.0f;
	playExplosionAnimation(p);
}