// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }
    
    CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
    CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();

    /////////////////////////////
    // 2. add a menu item with "X" image, which is clicked to quit the program
    //    you may modify it.

    // add a "close" icon to exit the progress. it's an autorelease object
    CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
                                        "CloseNormal.png",
                                        "CloseSelected.png",
                                        this,
                                        menu_selector(HelloWorld::menuCloseCallback));
    
	pCloseItem->setPosition(ccp(origin.x + visibleSize.width - pCloseItem->getContentSize().width/2 ,
                                origin.y + pCloseItem->getContentSize().height/2));

    // create menu, it's an autorelease object
    CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
    pMenu->setPosition(CCPointZero);
    this->addChild(pMenu, 1);

    /////////////////////////////
    // 3. add your codes below...
    CCNode* gameScene = SceneReader::sharedSceneReader()->createNodeWithSceneFile("DemoCowboy.json");
    addChild(gameScene);
    
    //Create player
    CCNode* playerNode = gameScene->getChildByTag(10004);
    player = new Player(playerNode);
    
    //Assign callbacks to the buttons
    CCNode* uiNode = gameScene->getChildByTag(10005);
    UILayer* ui = (UILayer*)uiNode->getComponent("GUIComponent")->getNode();
    
    UIButton* btnLeft = (UIButton*)ui->getWidgetByName("LeftButton");
    btnLeft->addTouchEventListener(this, toucheventselector(HelloWorld::onMoveLeft));
    
    UIButton* btnRight = (UIButton*)ui->getWidgetByName("RightButton");
    btnRight->addTouchEventListener(this, toucheventselector(HelloWorld::onMoveRight));
    
    UIButton* btnFire = (UIButton*)ui->getWidgetByName("FireButton");
//    btnFire->addReleaseEvent(this, coco_releaseselector(HelloWorld::onFire));
    btnFire->addTouchEventListener(this, toucheventselector(HelloWorld::onFire));
    
    //Enable update loop
    this->scheduleUpdate();
    
    return true;
}
void HelloWorld::update(float delta)
{
	if(m_bStart)
	{
		CCArmature *pHero = (CCArmature*)(m_pGameScene->getChildByTag(10005)->getComponent("CCArmature")->getNode());
		pHero->getParent()->setPositionX(pHero->getParent()->getPositionX() + m_fSpeed);
		CCArmature *pEnemy = (CCArmature*)(m_pGameScene->getChildByTag(10006)->getComponent("CCArmature")->getNode());

		if(ccpDistance(ccp(pHero->getParent()->getPositionX(), 0), ccp(pEnemy->getParent()->getPositionX(), 0)) < m_fAttackDis)
		{	
			pHero->getAnimation()->play("attack");
			pHero->getAnimation()->setMovementEventCallFunc(this,
                                                        movementEvent_selector(HelloWorld::animationEvent));
			m_bStart = false;
		}
	}

	if(m_bDead)
	{
		CCComRender *pUIRender = static_cast<CCComRender*>(m_pGameScene->getChildByTag(10007)->getComponent("GUIComponent"));
		UILayer *pUILayer = static_cast<UILayer*>(pUIRender->getNode());
		UILoadingBar *pHPLoadingBar = static_cast<UILoadingBar*>(pUILayer->getWidgetByName("hp02_LoadingBar"));
		UILoadingBar *pMPLoadingBar = static_cast<UILoadingBar*>(pUILayer->getWidgetByName("mp02_LoadingBar"));

		pHPLoadingBar->setPercent(m_fPercentage);
		pMPLoadingBar->setPercent(m_fPercentage);

		m_fPercentage -= 2.0f;
        if (m_fPercentage < 0.0f) {
            unscheduleUpdate();
        }
	}
	
}
Esempio n. 3
0
// on "init" you need to initialize your instance
void GameLoginLayer::onEnter()
{
    UILayer* uiLayer = UILayer::create();
    uiLayer->scheduleUpdate();
    
    UILayout* ui_root =dynamic_cast<UILayout*>(GUIReader::shareReader()->widgetFromJsonFile("plane_1.json"));
    uiLayer->addWidget(ui_root);
    
    UIButton *left_button = dynamic_cast<UIButton*>(uiLayer->getWidgetByName("TextButton_34"));
    left_button->addReleaseEvent(this, SEL_ReleaseEvent(&GameLoginLayer::loginBtnCallback));
    
    m_CCLayer->addChild(uiLayer);
}
Esempio n. 4
0
bool GestureScene::init() {
    if ( !CCLayer::init() ) 
        return false;
    CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
    CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
	this->setTouchEnabled(true);

	UILayer* uiLayer = UILayer::create();  
    uiLayer->addWidget(GUIReader::shareReader()->widgetFromJsonFile("UI/GestureUI/GestureUI.json"));  

	UIPanel* rootPanel = (UIPanel*)uiLayer->getWidgetByName("rootPanel");
	xLabel = (UILabel*) rootPanel->getChildByName("touchXLabel");
	yLabel = (UILabel*) rootPanel->getChildByName("touchYLabel");
	resultLabel = (UILabel*) rootPanel->getChildByName("gestureNameLabel");

    this->addChild(uiLayer, 2);

    return true;
}
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }
    
    CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
    CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();

    /////////////////////////////
    // 2. add a menu item with "X" image, which is clicked to quit the program
    //    you may modify it.

    // add a "close" icon to exit the progress. it's an autorelease object
    CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
                                        "visible.png",
                                        "visible.png",
                                        this,
                                        menu_selector(HelloWorld::btVisbleCallback));
    
	pCloseItem->setPosition(ccp(origin.x + visibleSize.width  - pCloseItem->getContentSize().width/2 ,
								origin.y + visibleSize.height - pCloseItem->getContentSize().height/2));

    // create menu, it's an autorelease object
    CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
    pMenu->setPosition(CCPointZero);
    this->addChild(pMenu, 1);


    // add "HelloWorld" splash screen"
    CCSprite* pSprite = CCSprite::create("HelloWorld.png");

    // position the sprite on the center of the screen
    pSprite->setPosition(ccp(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y));

    // add the sprite as a child to this layer
    this->addChild(pSprite, 0);
 


	/*Frame的测试*/
	
	Widget* frame = GUIReader::shareReader()->widgetFromJsonFile("UIRes/DemoLogin.ExportJson");
	
	UILayer* layer =UILayer::create();
	layer->setScale(0.8f); //缩放比例可以随便设置
	layer->addWidget(frame);
	this->addChild(layer);

	//触碰测试
	layer->getWidgetByName("login_Button")->addTouchEventListener(this,toucheventselector(HelloWorld::btMenuCallBack));
	layer->getWidgetByName("close_Button")->addTouchEventListener(this,toucheventselector(HelloWorld::btMenuCallBack));
	layer->getWidgetByName("agree_CheckBox")->addTouchEventListener(this,toucheventselector(HelloWorld::btMenuCallBack));
	layer->getWidgetByName("name_TextField")->addTouchEventListener(this,toucheventselector(HelloWorld::btMenuCallBack));
	layer->getWidgetByName("password_TextField")->addTouchEventListener(this,toucheventselector(HelloWorld::btMenuCallBack));
	layer->getWidgetByName("confirm_TextField")->addTouchEventListener(this,toucheventselector(HelloWorld::btMenuCallBack));

	//frame初始化,可以试一下不初始化,直接layer->setVisible(false);设置窗口不可见之后,鼠标点击原本的按钮区域,看看是否有对话框出现
	m_frame.setFrame(frame,(UIImageView*)layer->getWidgetByName("backageImg"));

	//设置触点在对话框外面时候的回调,在哪里设置对话框不可见,不可触碰
	m_frame.setTouchOutOfFrameEventListener(this,TouchOutOfFrameEvent_selector(HelloWorld::touchOutOfFrameCallback));

	m_frame.setFrameVisible(true);


    return true;
}
void Scene_GameItem::onEnter()
{
    CCLayer::onEnter();
    this->initData();
    
    //隐藏pk界面
    this->setPkView(false);
	CCSprite* pSpriteBG = (CCSprite*)getChildByTag(eGameItemTagBg);
	CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
	//pSpriteBG->setPosition(ccp(visibleSize.width/2 , pSpriteBG->getContentSize().height/2 + origin.y));
	

	char str1[100]={0};
	switch(GameShare_Global::shareGlobal()->gameType)
	{
	case 1:
		sprintf(str1,"GameSceneBg1.json");
		break;
	case Game_Jelly:
		sprintf(str1,"GameSceneBg2.json");
		break;
	case Game_Fruit: 
		sprintf(str1,"GameSceneBg3.json");
		break;
	case Game_Link:
		sprintf(str1,"GameSceneBg4.json");
		break;
	case Game_TaiKo: 
		sprintf(str1,"GameSceneBg5.json");
		break;
	case Game_Cir:
		sprintf(str1,"GameSceneBg1.json");
		break;
	default:
		break;
	}

	UILayer* ul = UILayer::create();
	auto myLayout = dynamic_cast<Layout*>(GUIReader::shareReader()->widgetFromJsonFile(CStringUtil::convertToUIResPath(str1).c_str()));
	ul->addWidget(myLayout);
	this->addChild(ul, 0, 100);
	ul->setTouchEnabled(false);

	int nGameType = GameShare_Global::shareGlobal()->gameType;
	if (nGameType==1)
	{
		UIImageView* pHill = dynamic_cast<UIImageView*>(ul->getWidgetByName("san"));
		UIImageView* pHill2 = dynamic_cast<UIImageView*>(ul->getWidgetByName("san2"));
		//CCActionInterval*  actionTo = CCScaleTo::create(2.0f, 0.5f);
		CCActionInterval*  actionBy = CCScaleBy::create(1.0f, 1.0f, 1.1f);
		CCActionInterval*  actionBy2 = CCScaleBy::create(1.0f, 1.1f, 1.0f);
		CCFiniteTimeAction* seq = CCSequence::create(actionBy, actionBy->reverse(),NULL);
		CCActionInterval * repeatForever =CCRepeatForever::create((CCActionInterval* )seq);
		CCFiniteTimeAction* seq1 = CCSequence::create(actionBy2, actionBy2->reverse(),NULL);
		CCActionInterval * repeatForever2 =CCRepeatForever::create((CCActionInterval* )seq1);
		pHill->runAction(repeatForever);
		pHill2->runAction(repeatForever2);
	}
	else if (nGameType==2)
	{
		UIImageView*  pCloud = dynamic_cast<UIImageView*>(ul->getWidgetByName("yun2"));
		UIImageView*  pCloud2 = dynamic_cast<UIImageView*>(ul->getWidgetByName("yun3"));
		CCActionInterval*  actionBy = CCScaleBy::create(1.5f, 1.2f, 1.0f);
		CCActionInterval*  actionBy2 = CCScaleBy::create(1.5f, 1.2f, 1.0f);
		CCFiniteTimeAction* seq1 = CCSequence::create(actionBy, actionBy->reverse(),NULL);
		CCFiniteTimeAction* seq2 = CCSequence::create(actionBy2, actionBy2->reverse(),NULL);
		CCActionInterval * repeatForever1 =CCRepeatForever::create((CCActionInterval* )seq1);
		CCActionInterval * repeatForever2 =CCRepeatForever::create((CCActionInterval* )seq2);
		pCloud->runAction(repeatForever1);
		pCloud2->runAction(repeatForever2);
	}
	else if (nGameType==3)
	{
		UIImageView*  pSugar = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_15"));
		UIImageView*  pSugar1 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_20"));
		CCRotateBy* actionBy2 = CCRotateBy::create(1.5f, -25.0f, -25.0f);
		CCRotateBy* actionBy1 = CCRotateBy::create(1.5f, -25.0f, -25.0f);
		CCFiniteTimeAction* seq1 = CCSequence::create(actionBy2, actionBy2->reverse(), NULL);
		CCFiniteTimeAction* seq2 = CCSequence::create(actionBy1, actionBy1->reverse(), NULL);
		CCActionInterval * repeatForever1 =CCRepeatForever::create((CCActionInterval* )seq1);
		CCActionInterval * repeatForever2 =CCRepeatForever::create((CCActionInterval* )seq2);
		pSugar->runAction(repeatForever1);
		pSugar1->runAction(repeatForever2);

		//星星
		UIImageView*  pXx1 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_23"));
		UIImageView*  pXx2 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_32"));
		UIImageView*  pXx3 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_35"));
		UIImageView*  pXx4 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_39"));

		CCActionInterval*  actionBy3 = CCScaleBy::create(1.2f, 1.3f, 1.3f);
		CCActionInterval*  actionBy4 = CCScaleBy::create(1.2f, 1.3f, 1.3f);
		CCActionInterval*  actionBy5 = CCScaleBy::create(1.2f, 1.3f, 1.3f);
		CCActionInterval*  actionBy6 = CCScaleBy::create(1.2f, 1.3f, 1.3f);
		
		CCFiniteTimeAction* seq3 = CCSequence::create(actionBy3, actionBy3->reverse(),NULL);
		CCFiniteTimeAction* seq4 = CCSequence::create(actionBy4, actionBy4->reverse(),NULL);
		CCFiniteTimeAction* seq5 = CCSequence::create(actionBy5, actionBy5->reverse(),NULL);
		CCFiniteTimeAction* seq6 = CCSequence::create(actionBy6, actionBy6->reverse(),NULL);
		
		CCActionInterval * repeatForever3 =CCRepeatForever::create((CCActionInterval* )seq3);
		CCActionInterval * repeatForever4 =CCRepeatForever::create((CCActionInterval* )seq4);
		CCActionInterval * repeatForever5 =CCRepeatForever::create((CCActionInterval* )seq5);
		CCActionInterval * repeatForever6 =CCRepeatForever::create((CCActionInterval* )seq6);
		//pCloud->runAction(repeatForever1);
		pXx1->runAction(repeatForever3);
		pXx2->runAction(repeatForever4);
		pXx3->runAction(repeatForever5);
		pXx4->runAction(repeatForever6);
	}
	else if (nGameType==4)
	{
		UIImageView* pTree = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_8"));
		UIImageView* pTree1 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_13"));
		//CCActionInterval*  actionTo = CCScaleTo::create(2.0f, 0.5f);
		CCActionInterval*  actionBy = CCScaleBy::create(1.0f, 1.0f, 1.1f);
		CCActionInterval*  actionBy2 = CCScaleBy::create(1.0f, 1.0f, 1.1f);
		CCFiniteTimeAction* seq = CCSequence::create(actionBy, actionBy->reverse(),NULL);
		CCActionInterval * repeatForever =CCRepeatForever::create((CCActionInterval* )seq);
		CCFiniteTimeAction* seq1 = CCSequence::create(actionBy2, actionBy2->reverse(),NULL);
		CCActionInterval * repeatForever2 =CCRepeatForever::create((CCActionInterval* )seq1);
		pTree->runAction(repeatForever);
		pTree1->runAction(repeatForever2);
	}
	else if (nGameType ==5)
	{
		UIImageView* pXx1 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_38"));
		UIImageView* pXx2 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_41"));
		CCActionInterval*  actionBy = CCScaleBy::create(1.0f, 0.5f, 0.5f);
		CCActionInterval*  actionBy2 = CCScaleBy::create(1.0f, 0.5f, 0.5f);
		CCFiniteTimeAction* seq = CCSequence::create(actionBy, actionBy->reverse(),NULL);
		CCActionInterval * repeatForever =CCRepeatForever::create((CCActionInterval* )seq);
		CCFiniteTimeAction* seq1 = CCSequence::create(actionBy2, actionBy2->reverse(),NULL);
		CCActionInterval * repeatForever2 =CCRepeatForever::create((CCActionInterval* )seq1);
		pXx1->runAction(repeatForever);
		pXx2->runAction(repeatForever2);

		UIImageView* pUFO1 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_15"));
		UIImageView* pUFO2 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Image_21"));
		CCMoveBy* act1 = CCMoveBy::create(2.0, ccp(0, -25));
		CCMoveBy* act2 = CCMoveBy::create(1.0, ccp(0, 25));
		CCFiniteTimeAction* seq3 = CCSequence::create(act1, act1->reverse(),NULL);
		CCFiniteTimeAction* seq4 = CCSequence::create(act2, act2->reverse(),NULL);
		CCActionInterval * repeatForever3 =CCRepeatForever::create((CCActionInterval* )seq3);
		CCActionInterval * repeatForever4 =CCRepeatForever::create((CCActionInterval* )seq4);
		pUFO1->runAction(repeatForever3);
		pUFO2->runAction(repeatForever4);
	}

	if(nGameType ==2||nGameType ==3||nGameType ==4)
	{
		UIImageView* pMg1 = dynamic_cast<UIImageView*>(ul->getWidgetByName("mg1"));
		UIImageView* pMg2 = dynamic_cast<UIImageView*>(ul->getWidgetByName("mg2"));
		UIImageView* pMg3 = dynamic_cast<UIImageView*>(ul->getWidgetByName("mg3"));
		CCActionInterval*  actionBy10 = CCScaleBy::create(1.0f, 1.0f, 1.3f);
		CCActionInterval*  actionBy11 = CCScaleBy::create(1.0f, 1.0f, 1.3f);
		CCActionInterval * actionBy12 = CCSkewTo::create(1, 8, 8);
		CCActionInterval * actionBy13 = CCSkewTo::create(1, 0, 0);
		CCActionInterval * actionBy14 = CCSkewTo::create(1, -8, -8);
		CCFiniteTimeAction* seq10 = CCSequence::create(actionBy10, actionBy10->reverse(),NULL);
		CCActionInterval * repeatForever10 =CCRepeatForever::create((CCActionInterval* )seq10);
		CCFiniteTimeAction* seq11 = CCSequence::create(actionBy11, actionBy11->reverse(),NULL);
		CCActionInterval * repeatForever11 =CCRepeatForever::create((CCActionInterval* )seq11);
		CCFiniteTimeAction* seq12 = CCSequence::create(actionBy12, actionBy13,actionBy14,NULL);
		CCActionInterval * repeatForever12 =CCRepeatForever::create((CCActionInterval* )seq12);

		pMg1->runAction(repeatForever10);
		pMg2->runAction(repeatForever11);
		pMg3->runAction(repeatForever12);
	}
    //
	CCSprite* pAniSp = (CCSprite*)getChildByTag(AniLayerTag);
	pAniSp->stopAllActions();
	CCAnimation* pAni1 = CCAnimation::create();
	CCString str;
	for (int i = 1; i <= 4; ++i){
		str.initWithFormat("role/pig_tl/%d.png",i);
		pAni1->addSpriteFrameWithFileName(str.getCString());
	}
	pAni1->setDelayPerUnit(0.15f);
	pAni1->setLoops(1);

	CCActionInterval* pSeq = CCSequence::create(CCFlipX::create(false),CCAnimate::create(pAni1),CCFlipX::create(true),CCAnimate::create(pAni1),NULL);
	pAniSp->runAction(CCRepeatForever::create(pSeq));

	pAniSp->setPosition(ccp(visibleSize.width/2 + 20,visibleSize.height - pAniSp->getContentSize().height/2 - 93 + 19 -26));

	
}
bool GameLayerPk2::init()
{
    if (!CCLayer::init()) {
        return false;
    }
    UILayer* ul = UILayer::create();
    auto myLayout = dynamic_cast<Layout*>(GUIReader::shareReader()->widgetFromJsonFile(CStringUtil::convertToUIResPath("Pk2.json").c_str()));
    ul->addWidget(myLayout);
    this->addChild(ul, 0, 100);
    
    UIButton* sureBtn = dynamic_cast<UIButton*>(ul->getWidgetByName("Sure"));
    sureBtn->setPressedActionEnabled(true);
    sureBtn->addReleaseEvent(this, coco_releaseselector(GameLayerPk2::sureBtnCallback));
    
    //设置自己的头像.
    UIImageView* cellBg = dynamic_cast<UIImageView*>(ul->getWidgetByName("Avatar1Bg"));
    CCSprite* img =  CCSprite::create();
    img->setContentSize(CCSize(145, 145));
    img->setAnchorPoint(ccp(0, 0));
    cellBg->addRenderer(img, 10);
    CImageDownloader::GetInstance()->SendHttpRequest(CPlayerInfoMan::sharedInstance().getPlayerInfo().strImg.c_str(), img, "1000", 1000);
    //设置自己的名字
    UILabel* nameLabel = dynamic_cast<UILabel*>(ul->getWidgetByName("Name1Label"));
    nameLabel->setText(CPlayerInfoMan::sharedInstance().getPlayerInfo().strName.c_str());
    
    //设置对方的头像
    UIImageView* cellBg2 = dynamic_cast<UIImageView*>(ul->getWidgetByName("Avatar2Bg"));
    CCSprite* img2 =  CCSprite::create();
    img2->setContentSize(CCSize(145, 145));
    img2->setAnchorPoint(ccp(0, 0));
    cellBg2->addRenderer(img2, 10);
    CImageDownloader::GetInstance()->SendHttpRequest(CPkSysManager::sharedInstance().playerUrl.c_str(), img2, "1000", 1000);
    //设置对方名字
    UILabel* nameLabel2 = dynamic_cast<UILabel*>(ul->getWidgetByName("Name2Label"));
    nameLabel2->setText(CPkSysManager::sharedInstance().playerName.c_str());
    
    //设置自己的分数.
    CCSprite* score = NumSprite::getNumSprite(CPkSysManager::sharedInstance().myScore, "./CocoStudioResources/FriendListTimeNum", 17.0);
    score->setPosition(ccp(-35, 0));
    UIImageView* scoreBg1 = dynamic_cast<UIImageView*>(ul->getWidgetByName("ScoreBg"));
    scoreBg1->addRenderer(score, 10);

	//等待迎战;
	m_iSetTime = 1;
	Deng  = dynamic_cast<UIImageView*>(ul->getWidgetByName("Label1"));
	Dai   = dynamic_cast<UIImageView*>(ul->getWidgetByName("Label2"));
	Ying  = dynamic_cast<UIImageView*>(ul->getWidgetByName("Label3"));
	Zhan  = dynamic_cast<UIImageView*>(ul->getWidgetByName("Label4"));
	Dain1  = dynamic_cast<UIImageView*>(ul->getWidgetByName("Label5"));
	Dain2  = dynamic_cast<UIImageView*>(ul->getWidgetByName("Label6"));
	Dain3  = dynamic_cast<UIImageView*>(ul->getWidgetByName("Label7"));
	CCActionInterval*  actionTo = CCJumpTo::create(2, ccp(200,200),50, 4);  
	CCActionInterval*  actionBy = CCJumpBy::create(2, ccp(300,0), 50, 4);  
	actionUp = CCJumpBy::create(0.3f, ccp(0,0), 20,1); 
	CCActionInterval*  actionByBack = actionUp->reverse();

	//设置光效旋转
	UIImageView* Ray2 = dynamic_cast<UIImageView*>(ul->getWidgetByName("lightimg"));
	CCActionInterval * rotateto = CCRotateBy::create(6.0f, 360);
	CCFiniteTimeAction* seq1 = CCSequence::create(rotateto,NULL);
	CCActionInterval * repeatForever2 =CCRepeatForever::create((CCActionInterval* )seq1);
	Ray2->runAction(repeatForever2);
	//Deng->runAction( CCSequence::create(actionUp, NULL));  
	//Dai->runAction( CCSequence::create(actionUp, NULL));

// 	for(int i = 0;i<10;i++)
// 	{
// 		if(i%2==0)
// 		{
// 			
// 			Deng->runAction(actionByBack);
// 		}
// 		else{
// 			
// 			Dai->runAction(actionByBack);
// 		}
// 	}
	//this->schedule(schedule_selector(GameLayerPk2::SetDDTime), 0.2f);
	
	Deng->runAction( CCSequence::create((CCActionInterval*)actionUp->copy(),NULL));
	Dai->runAction( CCSequence::create((CCActionInterval*)actionUp->copy(),NULL));
	Ying->runAction( CCSequence::create((CCActionInterval*)actionUp->copy(),NULL)); 
	Zhan->runAction( CCSequence::create((CCActionInterval*)actionUp->copy(),NULL)); 
	Dain1->runAction( CCSequence::create((CCActionInterval*)actionUp->copy(),NULL)); 
	Dain2->runAction( CCSequence::create((CCActionInterval*)actionUp->copy(),NULL)); 
	Dain3->runAction( CCSequence::create((CCActionInterval*)actionUp->copy(),NULL));
    return true;
}