cocos2d-x 3.x学习之RotateAction

#include"RotateActionScene.h"
Scene* RotateAction::createScene(){
	auto scene = Scene::create();
	auto layer = RotateAction::create();
	scene->addChild(layer);
	return scene;
}
bool RotateAction::init(){
	if (!Layer::init()){
		return false;
	}
	Size visibleSize = Director::getInstance()->getVisibleSize();
	auto dance = Sprite::create("dance.png");
	dance->setPosition(Point(visibleSize.width / 2, visibleSize.height / 2));
	this->addChild(dance);
	auto left = Sprite::create("dance.png");
	left->setPosition(Point(visibleSize.width / 2 - 300, visibleSize.height / 2));
	this->addChild(left);
	auto rotateTo1 = RotateTo::create(2, 45);
	auto rotateTo2 = RotateTo::create(2, 90);
	left->runAction(Sequence::create(rotateTo1, rotateTo2, NULL));
	auto right = Sprite::create("dance.png");
	right->setPosition(Point(visibleSize.width / 2 + 300, visibleSize.height / 2));
	this->addChild(right);
	auto rotateBy1 = RotateBy::create(2, 45);
	auto rotateBy2 = RotateBy::create(2, 90);
	right->runAction(Sequence::create(rotateBy1, rotateBy2, NULL));
	return false;
}

你可能感兴趣的:(cocos2d-x 3.x学习之RotateAction)