首页 > 代码库 > [cocos2d-x]-会动的精灵

[cocos2d-x]-会动的精灵

小鸟一直在扑翅膀的代码块:

	auto sprite = Sprite::create();
	Animation *animation = Animation::create();
	animation->addSpriteFrameWithFileName("bird_blue_1.png");
	animation->addSpriteFrameWithFileName("bird_blue_2.png");
	animation->addSpriteFrameWithFileName("bird_blue_0.png");
	animation->setLoops(-1);
	animation->setDelayPerUnit(0.5/3.0);
	animation->setRestoreOriginalFrame(true);
	Animate *animate = Animate::create(animation);
	sprite->runAction(RepeatForever::create(animate));