最难游戏代码续3_skybeauty_新浪博客

 

#ifndef __HardestGameEver__pause__

#define __HardestGameEver__pause__

#include "cocos2d.h"

USING_NS_CC;

#include <iostream>

class Pause:public CCLayer

{

public:

   bool init(int tag);

   static CCScene * scene(int tag);

   void resume();

   void setting();

   void back();

 static Pause*create(int tag);

   virtual ~Pause();

private:

   int tag;


    

    

};

#endif





 

#include "pause.h"

#include "GameScene2.h"

#include "buttonpress.h"

#include "setting.h"

#include "GameBegain.h"

#include "GameScene.h"

bool Pause::init(int tag)

{

    CCSize size = CCDirector::sharedDirector()->getWinSize();

   if (!CCLayer::init())

    {

        return false;

    }

   

    

   this->tag = tag;

     

    //添加背景

   CCSprite * backround = CCSprite::create("pause_bg-iphone4.jpeg");

    backround->setPosition(ccp(size.width*0.5, size.height*0.5));

   this->addChild(backround);

    

      

    //添加按钮

    CCMenuItemImage * back = CCMenuItemImage::create("setting_home-iphone4.png", "setting_home-iphone4.png", this, menu_selector(Pause::back));

    back->setScale(1.25);

    back->setPosition(ccp(back->getContentSize().width, back->getContentSize().height*0.55));

    CCMenuItemImage * setting = CCMenuItemImage::create("bt_setting-iphone4.png", "bt_setting-iphone4.png", this, menu_selector(Pause::setting));

    setting->setPosition(ccp(size.width*0.5, setting->getContentSize().height*0.5));

    CCMenuItemImage * resume = CCMenuItemImage::create("bt_resume-iphone4.png", "bt_resume-iphone4.png", this, menu_selector(Pause::resume));

    resume->setPosition(ccp(size.width-resume->getContentSize().width, resume->getContentSize().height*0.5));

   CCMenu * menu = CCMenu::create(back,setting,resume,NULL);

   this->addChild(menu,1000);

    menu->setPosition(CCPointZero);

    

       

    

    return true;

}

CCScene*Pause::scene(int tag)

{

   CCScene * scene = CCScene::create();

   Pause * layer = Pause::create(tag);

    scene->addChild(layer);

   return scene;

}

Pause*Pause::create(int tag)

{

   Pause * pRet = new Pause();

   if (pRet&&pRet->init(tag))

    {

        pRet->autorelease();

       return pRet;

    }

   else

    {

        CC_SAFE_RELEASE_NULL(pRet);

       return NULL;

    }

}


void Pause::resume()

{

   if(tag==1)

    {

        GameScene::shared()->setTouchEnabled(true);

        CCDirector::sharedDirector()->popScene();

    

        

    }

   else if (tag == 2)

    {

       GameSceneB::shared()->start(1);

        

        CCDirector::sharedDirector()->popScene();

       GameSceneB::shared()->stopbutton(0);

        

    }

    


}

void Pause::setting()

{

   if(tag==1)

    {

        GameScene::shared()->setTouchEnabled(false);

        CCDirector::sharedDirector()->popScene();

       GameScene::shared()->replace(Setting::scene());

    }

   else if (tag == 2)

    {

       GameSceneB::shared()->stopbutton(1);

        

        CCDirector::sharedDirector()->popScene();

       GameSceneB::shared()->replace(Setting::scene());

        

    }


       

}

void Pause::back()

{

   if(tag==1)

    {

        GameScene::shared()->setTouchEnabled(false);

        CCDirector::sharedDirector()->popScene();

       GameScene::shared()->replace(GameBegain::scene());

    }

   else if (tag == 2)

    {

       GameSceneB::shared()->stopbutton(1);

        CCDirector::sharedDirector()->popScene();

       GameSceneB::shared()->replace(GameBegain::scene());

        

    }


      

}

Pause::~Pause()

{

    this->removeAllChildren();

}


最难游戏代码续3

 

#ifndef __HardestGameEver__Instruction__

#define __HardestGameEver__Instruction__

#include "cocos2d.h"

using namespace cocos2d;

#include <iostream>

class Instruction:public CCLayerColor

{

public:

   bool init(int tag);

   static CCScene * scene(int tag);

   void play();

   void play1();

   static Instruction*create(int tag);

   virtual void keyBackClicked();

    

   virtual~Instruction();

private:

   CCLabelTTF * label;

   CCString*string;

   CCString * stage;

    

};


#endif



 

#include "Instruction.h"

#include "LoadingScene.h"

#include "SimpleAudioEngine.h"

#include "GameChoose.h"

bool Instruction::init(int tag)

{

    CCSize size = CCDirector::sharedDirector()->getWinSize();

   if (!CCLayerColor::init())

    {

        return false;

    }

    

    this->setKeypadEnabled(true);

   stage = CCString::createWithFormat("Stage%d",tag);

    

    //添加绿色背景

   CCLayerColor * s = CCLayerColor::create(ccc4(200, 255, 0, 200));

   this->addChild(s);

    //添加label

    CCSprite * player = CCSprite::create("title_play-iphone4.png");

   this->addChild(player);

    if (CCRANDOM_0_1()>0.5)

    {

        player->setPosition(ccp(size.width-player->getContentSize().width, size.height-player->getContentSize().height));

    }

   else

    {

        player->setPosition(ccp(size.width*0.5,size.height-player->getContentSize().height));

       

    }

    

    

    

        

    //添加instruct

    CCSprite * instruct = CCSprite::create("title_blog-iphone4.png");

   this->addChild(instruct);

    instruct->setPosition(ccp(size.width*0.5,size.height*0.5));

    

    label = CCLabelTTF::create();

    

   if (tag==1)

    {

        

        string = CCString::create("以最快的速度掌掴这个人恰好[37]!\n记住在完成后点击[完成]");

       //添加游戏图标

        

        CCSprite * game = CCSprite::create("select_image19-iphone4.png");

       this->addChild(game);

        

       //添加tv图片

        CCSprite * tv = CCSprite::create("select_stage01-iphone4.png");

       this->addChild(tv);

        tv->setPosition(ccp(size.width-tv->getContentSize().width*0.5, size.height-tv->getContentSize().height*1.5));

        game->setPosition(tv->getPosition());

        //添加play

        CCMenuItemImage * play = CCMenuItemImage::create("title_btplay-iphone4.png", "title_btplay-iphone4.png", this, menu_selector(Instruction::play1));

        

        play->setPosition(ccp(player->getPositionX()+player->getContentSize().width*0.75,player->getPositionY()));

       CCMenu * m = CCMenu::create(play,NULL);

       this->addChild(m);

        m->setPosition(CCPointZero);


        


    }

   else if (tag==2)

    {

        

        string = CCString::create("尽可能在接近0.00秒时停止炸弹!\n分数取决于每颗炸弹停止时剩余的总\n时间");

    //添加游戏图标

    

    CCSprite * game = CCSprite::create("select_image14-iphone4.png");

   this->addChild(game);

        

    //添加tv图片

    CCSprite * tv = CCSprite::create("select_stage01-iphone4.png");

   this->addChild(tv);

    tv->setPosition(ccp(size.width-tv->getContentSize().width*0.6, size.height-tv->getContentSize().height*1.2));

    game->setPosition(tv->getPosition());

        //添加play

        CCMenuItemImage * play = CCMenuItemImage::create("title_btplay-iphone4.png", "title_btplay-iphone4.png", this, menu_selector(Instruction::play));

        

        play->setPosition(ccp(player->getPositionX()+player->getContentSize().width*0.75,player->getPositionY()));

       CCMenu * m = CCMenu::create(play,NULL);

       this->addChild(m);

        m->setPosition(CCPointZero);


                

    }

    

    label->setString(string->getCString());

    label->setFontName("Verdana");

    label->setFontSize(15);

    

   this->addChild(label);

   label->setPosition(ccp(size.width*0.5, size.height*0.5));

   label->setColor(ccc3(225, 0, 0));

    

    //添加评分

    CCSprite * score = CCSprite::create("score01-iphone4.png");

   this->addChild(score);

    score->setPosition(ccp(size.width*0.5, -score->getContentSize().height));

   CCMoveTo *move = CCMoveTo::create(0.5f, ccp(size.width*0.5, score->getContentSize().height*0.60));

   

    score->runAction(move);

   CCMoveTo * move1 = CCMoveTo::create(0.5f, ccp(score->getContentSize().width*0.9, score->getContentSize().height*0.65));

    

   CCBlink * blink = CCBlink::create(0.5f, 5);

    

   CCSequence * sequence = CCSequence::create(move1,blink,NULL);

    CCSprite * score2 = CCSprite::create("Result_Scene_score04-iphone4.png");

   this->addChild(score2);

    score2->setPosition(ccp(score->getContentSize().width*0.9, -score->getContentSize().height));

    score2->runAction(sequence);

    

    

    CCLabelBMFont * text = CCLabelBMFont::create(stage->getCString(), "pic.fnt", 35, kCCTextAlignmentLeft);

   this->addChild(text);

    text->setScale(0.75);

    

    

    text->setPosition(ccp(size.width*0.3, size.height*0.65));


    

    

    

       

    return true;

}

CCScene*Instruction::scene(int tag)

{

   CCScene * scene = CCScene::create();

   Instruction * layer = Instruction::create(tag);

    scene->addChild(layer);

   return scene;

}

Instruction * Instruction::create(int tag)

{

    Instruction *pRet = new Instruction();

   if (pRet&&pRet->init(tag))

    {

        pRet->autorelease();

       return pRet;

    }

   else

    {

        CC_SAFE_RELEASE_NULL(pRet);

       return NULL;

    }

    

}

void Instruction::play()

{

     CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("gen_click.mp3");

    Loadingscene * s = Loadingscene::creat(TargetSceneGameSceneBScene, 0);

    CCDirector::sharedDirector()->replaceScene(s);


}

void Instruction::play1()

{

    CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("gen_click.mp3");

    Loadingscene * s = Loadingscene::creat(TargetSceneGameSceneScene, 0);

    CCDirector::sharedDirector()->replaceScene(s);

}

Instruction::~Instruction()

{

    this->removeAllChildren();

}

void Instruction::keyBackClicked()

{

   CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("08_tap.mp3");

    CCDirector::sharedDirector()->replaceScene( GameChoose::scene());

}




最难游戏代码续3


#ifndef __HardGame__GameScene__

#define __HardGame__GameScene__


#include "cocos2d.h"


using namespace cocos2d;

class GameScene : public cocos2d::CCLayer

{

public:

   virtual bool init();

   static cocos2d::CCScene* scene();

    CREATE_FUNC(GameScene);

   void update(float dt);

   static GameScene *shared();

   virtual void replace(CCScene*scene);

   void fail();

   virtual void keyMenuClicked();

   virtual void keyBackClicked();

   void yes();

   void no();

   

    ~GameScene();

    

private:

   int tag;

   CCSprite* boy;

   CCSprite* blue;

   CCSprite* slap;

   CCSprite* done;

   bool isToucheMe(CCPoint pos);

   void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent);

   void slapFun();

   void doneFun();

   void move();

   virtual void refresh();

   virtual void pause();

   void settouch();

   void startupdate();


    

   int u,i,j,k;

   CCString* s1;

   CCString* s2;

   CCString* sCount;

   CCLabelBMFont* label1;

   CCLabelBMFont* label2;

   CCLabelBMFont* labelCount;

   static GameScene*game;

   void womenScreamDelay();


   bool up;

   int count;


};


#endif 




#include "GameScene.h"

#include "InstantFail.h"

#include "SimpleAudioEngine.h"

#include "LoadingScene.h"

#include "GameScene2.h"

#include "pause.h"

#include "fail.h"

#include "GameBegain.h"


using namespace cocos2d;

using namespace CocosDenshion;

GameScene*GameScene::game = NULL;

CCScene* GameScene::scene()

{

   CCScene* scene = CCScene::create();

   GameScene* layer = GameScene::create();

    scene->addChild(layer);

   return scene;

    

}

bool GameScene::init()

{

   if ( !CCLayer::init() )

    {

        return false;

    }

   game = this;

    this->setKeypadEnabled(true);

    CCSize size = CCDirector::sharedDirector()->getWinSize();

    

    //添加readygo

    SimpleAudioEngine::sharedEngine()->playEffect("readyGo.mp3");

   CCSprite * ready = CCSprite::create("ready-iphone4.png");

    


    

   this->addChild(ready, 3,1000);

    

    ready->setPosition(ccp(size.width*0.5, size.height*0.5f));

    

    

    this->scheduleOnce(schedule_selector(GameScene::womenScreamDelay), 1.5);

    this->scheduleOnce(schedule_selector(GameScene::move), 0.5);

    


    

   //背景

    CCSprite* sp = CCSprite::create("19_bg-iphone4.jpeg");

    

    sp->setPosition(ccp(size.width*0.5, size.height*0.5));

    

   addChild(sp,0);

    

     //label

    s1 = CCString::createWithFormat("%d%d",u,i);

    label1 = CCLabelBMFont::create(s1->getCString(), "number.fnt", 10, kCCTextAlignmentLeft);

   

    s2 = CCString::createWithFormat("%d%d",j,k);

    label2 = CCLabelBMFont::create(s2->getCString(), "number.fnt", 10, kCCTextAlignmentLeft);

    

   label2->setPosition(ccp(size.width/2 + 50,size.height/2));

   label2->setScale(0.5);

    

    

    

    

   //蓝条

    blue = CCSprite::create("stage_word-iphone4.png");

    

    blue->setRotation(-90);

   blue->setPosition(ccp(size.width/2 - 160 -50 , size.height*0.8));

    CCRotateBy*cb = CCRotateBy::create(0.5, 97);

   blue->runAction(cb);

    label1->setPosition(ccp(blue->getPositionX()+350, 25));

    label2->setPosition(ccp(blue->getPositionX()+410, 35));

   label2->setScale(0.5);

   blue->addChild(label1,2);

   blue->addChild(label2,2);

   addChild(blue,2);

    

        

    

   //男孩

    boy = CCSprite::create("19_man-iphone4.png");

    

   boy->setPosition(ccp(size.width*0.5, size.height*0.5));

    

   addChild(boy,1);

    

   //女人

    CCSprite* women = CCSprite::create("19_beforegame-iphone4.jpeg");

    

    women->setPosition(ccp(size.width/2 - 350, size.height/2));

 

    

    

   CCMoveTo* womenMove1 = CCMoveTo::create(0.1, ccp(size.width/2, size.height/2));

   CCMoveTo* womenMove2 = CCMoveTo::create(0.1, ccp(size.width/2 + 350, size.height/2));

    

   CCDelayTime* Move1Delay = CCDelayTime::create(1.5);


   CCDelayTime* Move2Delay = CCDelayTime::create(0.5);

    

   CCSequence* womenAction = CCSequence::create(Move1Delay,womenMove1,Move2Delay,womenMove2,NULL);

    

    women->runAction(womenAction);

    

   addChild(women,4);

    

    

    //2个按键

    slap = CCSprite::create("00_bigRbt-iphone4.png");

    

   slap->setPosition(ccp(size.width*0.25, size.height*0.1));

    

   addChild(slap,3,11);

    

    done = CCSprite::create("00_bigBbt-iphone4.png");

    

   done->setPosition(ccp(size.width*0.75, size.height*0.1));

    

   addChild(done,3,12);

    

    

        

    

   

    

   //计数

    

   count = 0;

    

    sCount = CCString::createWithFormat("%d",count);

    labelCount = CCLabelBMFont::create(sCount->getCString(), "count.fnt", 10, kCCTextAlignmentLeft);

   labelCount->setPosition(ccp(size.width/2,0));

   CCMoveTo* labelCountMove1 = CCMoveTo::create(0.1, ccp(0,130));

   CCMoveTo* labelCountMove2 = CCMoveTo::create(0.1, ccp(0,120));

   CCDelayTime* labelMove1Delay = CCDelayTime::create(2.5);

   CCSequence* labelCountMove = CCSequence::create(labelMove1Delay,labelCountMove1,labelCountMove2,NULL);

    

   CCLabelBMFont* labelSlaps = CCLabelBMFont::create("SLAPS", "Zt.fnt", 10, kCCTextAlignmentLeft);

    

    labelSlaps->setPosition(ccp(labelCount->getPosition().x+100,labelCount->getPosition().y));

    labelSlaps->setScale(0.5);

  

   CCNode* labelAll = CCNode::create();

    labelAll->addChild(labelCount);

    labelAll->addChild(labelSlaps);

    labelAll->runAction(labelCountMove);

    

   this->addChild(labelAll,2);

    //添加游戏场景的菜单

    CCMenuItemImage * pause = CCMenuItemImage::create("stage_button01-iphone4.png", "stage_button01-iphone4.png", this, menu_selector(GameScene::pause));

    pause->setPosition(ccp(size.width, size.height*0.7));

    CCMenuItemImage * refresh = CCMenuItemImage::create("stage_button02-iphone4.png", "stage_button02-iphone4.png", this, menu_selector(GameScene::refresh));

    refresh->setPosition(ccp(size.width, size.height*0.8));

   CCMenu * menu = CCMenu::create(pause,refresh,NULL);

    menu->setPosition(CCPointZero);

   this->addChild(menu,3);

    this->scheduleOnce(schedule_selector(GameScene::settouch), 2.7);


   up = true;

    

    

    return true;

}


void GameScene::refresh()

{

    CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("gen_click.mp3");

    Loadingscene * s = Loadingscene::creat(TargetSceneGame2Scene, 1);

    CCDirector::sharedDirector()->replaceScene(s);

    

}

void GameScene::pause()

{

    CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("gen_click.mp3");

    CCDirector::sharedDirector()->pushScene(Pause::scene(1));

    this->setTouchEnabled(false);

      

}

void GameScene::startupdate()

{

   up = false;

    this->scheduleUpdate();

}



void GameScene::ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent)

{

   CCTouch * touch = (CCTouch *)pTouches->anyObject();

   CCPoint location = touch->getLocation();

   if (isToucheMe(location))

    {

               switch (tag)

                {

                   case 0:

                    {

                       this->slapFun();

                        

                       count++;

                       //计数

                       sCount = CCString::createWithFormat("%d",count);

                        

                       labelCount->setString(sCount->getCString());

                        CCUserDefault::sharedUserDefault()->setIntegerForKey("count", sCount->intValue());

                       break;

                        

                        

                    }

                   case 1:

                    {

                       this->doneFun();

                       break;

                    }

        

                   default:

                       break;

                }

        


        

    }

}

void GameScene::slapFun()

{

    CCSize size = CCDirector::sharedDirector()->getWinSize();

    this->removeChild(boy);

   static int i = 0;

    

          

       if (i == 0)

        {

            SimpleAudioEngine::sharedEngine()->playEffect("19_slap.mp3");

           this->removeChildByTag(101);

           CCSprite* boy1 = CCSprite::create("19_man_left-iphone41.png");

            boy1->setPosition(ccp(size.width*0.5,size.height*0.5));

           this->addChild(boy1,1,100);

            i++;

        }

       else if(i == 1)

        {

            SimpleAudioEngine::sharedEngine()->playEffect("19_slap.mp3");

           this->removeChildByTag(100);

            CCSprite* boy2 = CCSprite::create("19_man_right-iphone41.png");

            boy2->setPosition(ccp(size.width*0.5,size.height*0.5));

           this->addChild(boy2,1,101);

            i--;

        }

   if (count==38)

    {

        this->unscheduleUpdate();


        this->setTouchEnabled(false);

        

       this->fail();

        

    }


   if(up)

    {

       this->startupdate();

    }


}


void GameScene::doneFun()

{

    this->setTouchEnabled(false);

    this->unscheduleUpdate();

   if (count<37)

    {

        

       this->fail();

    }

   else 

    {

       

       if(u<1)

        {

            

           if(i<3)

            {

                CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("perfect.mp3");

            }

           else if(i<4)

            {

                CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("great.mp3");

            }

           else if(i<5)

            {

                CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("good.mp3");

            }

           else

            {

                CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("okay.mp3");

            }

           

            CCDirector::sharedDirector()->replaceScene(Loadingscene::creat(TargetSceneWin1Scene, 3));

           

        }

       else

        {

            

            CCDirector::sharedDirector()->replaceScene(Loadingscene::creat(TargetSceneScore1Scene, 3));

        }

        

    

    }


    

}


void GameScene::update(float dt)

{


   k++;

   if(k > 5)

    {

       k = 0;

       j++;

    }

   if(j > 9)

    {

       j = 0;

       i++;

    }

   if(i > 9)

    {

       i = 0;

       u++;

    }

   if(u > 9)

    {

       u = 0;

    }

    

    s1 = CCString::createWithFormat("%d%d",u,i);

    s2 = CCString::createWithFormat("%d%d",j,k);

    label1->setString(s1->getCString());

    label2->setString(s2->getCString());

       if (count>10)

    {

       CCDelayTime * delay = CCDelayTime::create(1);

       CCFadeIn * action = CCFadeIn::create(1.0);

       CCSequence *sequence = CCSequence::create(delay,action,NULL);

       labelCount->runAction(sequence);

    }

    CCUserDefault::sharedUserDefault()->setIntegerForKey("sc", s1->intValue());

    CCUserDefault::sharedUserDefault()->setFloatForKey("cs",s2->intValue());

       

}




bool GameScene::isToucheMe(CCPoint pos)

{

    

    //slap键的rect

   CCRect touchrect = CCRectMake(slap->getPosition().x - 160/2, slap->getPosition().y - 102/2, 160, 102);

    //Donerect

   CCRect touchrect2 = CCRectMake(done->getPosition().x - 160/2, done->getPosition().y - 102/2, 160, 102);

   if (touchrect.containsPoint(pos))

    {

        tag = 0;

        

       return true;

    }

       else if (touchrect2.containsPoint(pos))

        {

           tag = 1;

           return true;

        }

   else

    {

        return false;

    }

}

void GameScene::move()

{

    CCSize size = CCDirector::sharedDirector()->getWinSize();

    this->removeChildByTag(1000);

    

   CCSprite * ready = CCSprite::create("go-iphone4.png");

    

   this->addChild(ready, 3);

    

    ready->setPosition(ccp(size.width*0.5, size.height*0.5f));

    

   CCMoveTo * action = CCMoveTo::create(0.5f, ccp(-ready->getContentSize().width*0.5, size.height*0.5));

    

    ready->runAction(action);

    

     

}

GameScene*GameScene::shared()

{

   return game;

}

void GameScene::replace(CCScene*scene)

{

    CCDirector::sharedDirector()->replaceScene(scene);

    

    

}

void GameScene::fail()

{

    CCSize size = CCDirector::sharedDirector()->getWinSize();

    

    CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("whistle.mp3");

    Fail * fail = Fail::create("Instant_out-iphone4.png",1);

    fail->setPosition(ccp(20, size.height*0.4));

   this->addChild(fail,4);

}

void GameScene::womenScreamDelay()

{

    SimpleAudioEngine::sharedEngine()->playEffect("19_scream.mp3");


}

GameScene::~GameScene()

{

    this->unscheduleAllSelectors();

    this->removeAllChildren();

    

}

void GameScene::settouch()

{

    this->setTouchEnabled(true);

}

void GameScene::keyMenuClicked()

{

    CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("ComboMax.mp3");

    CCDirector::sharedDirector()->replaceScene(GameBegain::scene());

    

}

void GameScene::keyBackClicked()

{

    CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("ComboMax.mp3");

    

    this->setTouchEnabled(false);

    this->unscheduleUpdate();

    

    CCLabelTTF * label = CCLabelTTF::create("确定要退出游戏么?", "MarkerFelt-Thin", 15);

   CCSprite * bac = CCSprite::create("rt4c.jpg");

   this->addChild(bac,2,33);

    bac->setPosition(ccp(160, 480+bac->getContentSize().height*0.5));

    CCMenuItemImage * yes = CCMenuItemImage::create("arcade_button02-iphone41.png", "arcade_button02-iphone41.png", this, menu_selector(GameScene::yes));

    yes->setPosition(ccp(bac->getContentSize().width*0.25, bac->getContentSize().height*0.5));

    

    CCMenuItemImage * no = CCMenuItemImage::create("arcade_button01-iphone4.png", "arcade_button01-iphone4.png", this, menu_selector(GameScene::no));

    no->setPosition(ccp(bac->getContentSize().width*0.75,bac->getContentSize().height*0.5));

   CCMenu * s = CCMenu::create(yes,no,NULL);

    s->setPosition(CCPointZero);

    bac->addChild(s);

    bac->addChild(label);

    label->setPosition(ccp(bac->getContentSize().width*0.5, bac->getContentSize().height*0.75));

   CCMoveTo * action = CCMoveTo::create(1.0f, ccp(160, 240));

    bac->runAction(action);


}


void GameScene::yes()

{

     CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("gen_click.mp3");

    this->removeChildByTag(33);

    CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("ComboMax.mp3");

    CCDirector::sharedDirector()->end();

    

#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)

   exit(0);

#endif


}

void GameScene::no()

{

     CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("gen_click.mp3");

    this->removeChildByTag(33);

   this->settouch();

    this->scheduleUpdate();

}

最难游戏代码续3


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值