別踩白塊設(shè)計(jì)說(shuō)明文檔_第1頁(yè)
別踩白塊設(shè)計(jì)說(shuō)明文檔_第2頁(yè)
別踩白塊設(shè)計(jì)說(shuō)明文檔_第3頁(yè)
別踩白塊設(shè)計(jì)說(shuō)明文檔_第4頁(yè)
別踩白塊設(shè)計(jì)說(shuō)明文檔_第5頁(yè)
已閱讀5頁(yè),還剩34頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、別踩白塊2015經(jīng)典版設(shè)計(jì)說(shuō)明版本號(hào):V1.0 一、設(shè)計(jì)原理: 一款休閑類游戲,依靠玩家反應(yīng)能力獲得更多的黑塊。 針對(duì)碎片時(shí)間較多、對(duì)反應(yīng)能力有自信的人。整個(gè)頁(yè)面由黑白兩種色塊組成,頁(yè)面分為4列,4列中每一行隨機(jī)刷新一個(gè)黑塊,玩家需要依次點(diǎn)擊刷新的黑塊才能繼續(xù)游戲,漏點(diǎn)或點(diǎn)擊白塊后判定失敗。二、設(shè)計(jì)流程:游戲模式:游戲模式主要有3種,經(jīng)典模式、禪模式、街機(jī)模式。經(jīng)典模式:以最快的速度準(zhǔn)確的完成50塊黑塊的收集。勝負(fù)判定:玩家準(zhǔn)確收集完50個(gè)黑塊,判定勝利并記錄時(shí)間;玩家點(diǎn)擊了白塊則判定失敗。禪模式: 在規(guī)定的時(shí)間內(nèi)(30s)盡可能的收集黑塊。勝負(fù)判定:玩家在30s內(nèi)準(zhǔn)確的收集黑塊,記錄收集的黑

2、塊數(shù)量;玩家點(diǎn)擊白塊則判定失敗。街機(jī)模式:屏幕會(huì)以一定的速度(速度會(huì)逐漸上升)向下刷新黑白塊,玩家必須準(zhǔn)確點(diǎn)擊黑塊。勝負(fù)判定:玩家點(diǎn)擊白塊或漏點(diǎn)黑塊則判定玩家失敗,記錄當(dāng)前收集黑塊數(shù)。設(shè)計(jì)流程圖:經(jīng)典模式 禪模式街機(jī)模式道具道具名稱描述概率(暫定)價(jià)格(暫定)復(fù)活玩家死亡后可復(fù)活繼續(xù)游戲,復(fù)活后有3秒準(zhǔn)備時(shí)間100%200鉆石三、UI設(shè)計(jì)說(shuō)明: 界面關(guān)系流程圖: 主界面:戰(zhàn)斗界面:商城界面: 復(fù)活界面: 結(jié)算界面禮包界面: 四、 軟件架構(gòu)圖五、 算法1、游戲首界面代碼#ifndef _whiteBlock_FirstScene_#define _whiteBlock_FirstScene_#i

3、nclude "cocos2d.h"USING_NS_CC;class FirstScene : public cocos2d:CCLayerpublic: FirstScene(); FirstScene(); virtual bool init(); static cocos2d:CCScene* scene(); void replaceScene(CCObject *objectz); virtual void keyBackClicked(); void queding(); void quxiao(); void toShangDian(); CREATE_FU

4、NC(FirstScene);private: int model; CCMenu* replaceSceneMenu; CCSprite* tuichuSprite; CCMenu* tuichumenu; CCLabelTTF* goldLabel;;#endif /* defined(_whiteBlock_FirstScene_) */ FirstScene.cpp/ whiteBlock/ Created by liuqingyun on 14-12-7./#include "FirstScene.h"#include "MainScene.h"

5、;#include "Define.h"#include "UserData.h"#include "ShangdianScene.h"FirstScene:FirstScene():replaceSceneMenu(NULL)FirstScene:FirstScene()CCScene* FirstScene:scene() CCScene *scene = CCScene:create(); FirstScene *layer = FirstScene:create(); scene->addChild(layer); re

6、turn scene;bool FirstScene:init() if ( !CCLayer:init() ) return false; CCSize size=CCDirector:sharedDirector()->getWinSize(); CCSprite* baoshi=CCSprite:create("zhuangshi.png"); baoshi->setPosition(ccp(50, size.height-50); addChild(baoshi); int baoshishuliang=UserData:getIntegerForKey

7、(GOLD); CCLog("baoshishuliang is %d",baoshishuliang); CCString* baoshishu=CCString:createWithFormat("%d",baoshishuliang); goldLabel = CCLabelTTF:create(baoshishu->getCString(), "arial", 30); goldLabel->setAnchorPoint(ccp(0, 0.5); goldLabel->setPosition(ccp(100,

8、size.height-50); this->addChild(goldLabel,5); CCMenuItemImage *addGoldItem = CCMenuItemImage:create( "jiahao.png", "jiahao.png", this, menu_selector(FirstScene:toShangDian);addGoldItem->setPosition(ccp(150+goldLabel->getContentSize().width,size.height-50); CCMenu* pMenu1

9、 = CCMenu:create(addGoldItem, NULL); pMenu1->setPosition(CCPointZero); this->addChild(pMenu1); CCMenuItemImage *jingdianItem = CCMenuItemImage:create( "jingdian.png", "jingdian.png", this, menu_selector(FirstScene:replaceScene);jingdianItem->setPosition(ccp(size.width/2,

10、 size.height/2+200); jingdianItem->setTag(JINGDIAN); CCMenuItemImage *chanItem = CCMenuItemImage:create( "chan.png", "chan.png", this, menu_selector(FirstScene:replaceScene); chanItem->setPosition(ccp(size.width/2, jingdianItem->getPositionY()-150); chanItem->setTag(C

11、HAN); CCMenuItemImage *jiejiItem = CCMenuItemImage:create( "jieji.png", "jieji.png", this, menu_selector(FirstScene:replaceScene);jiejiItem->setPosition(ccp(size.width/2, chanItem->getPositionY()-150); jiejiItem->setTag(JIEJI); CCMenuItemImage *shangchengItem = CCMenuIte

12、mImage:create( "shangcheng.png", "shangcheng.png", this, menu_selector(FirstScene:toShangDian);shangchengItem->setPosition(ccp(size.width/2, jiejiItem->getPositionY()-150); replaceSceneMenu = CCMenu:create(jingdianItem,chanItem,jiejiItem,shangchengItem, NULL); replaceSceneM

13、enu->setPosition(CCPointZero); this->addChild(replaceSceneMenu); tuichuSprite=CCSprite:create("tuichuBoard.png"); tuichuSprite->setPosition(ccp(size.width/2, size.height/2); tuichuSprite->setVisible(false); addChild(tuichuSprite); CCMenuItemImage *pQuedingItem = CCMenuItemImage

14、:create( "queding.png", "queding.png", this, menu_selector(FirstScene:queding);pQuedingItem->setPosition(ccp(tuichuSprite->getContentSize().width/4,50); CCMenuItemImage *pQuxiaoItem = CCMenuItemImage:create( "quxiao.png", "quxiao.png", this, menu_selecto

15、r(FirstScene:quxiao);pQuxiaoItem->setPosition(ccp(tuichuSprite->getContentSize().width/4*3,50); tuichumenu = CCMenu:create(pQuedingItem,pQuxiaoItem, NULL); tuichumenu->setPosition(CCPointZero); tuichuSprite->addChild(tuichumenu); return true;void FirstScene:keyBackClicked() tuichuSprite-

16、>setVisible(true);void FirstScene:queding() CCDirector:sharedDirector()->end();void FirstScene:quxiao() tuichuSprite->setVisible(false);void FirstScene:replaceScene(CCObject *object) CCMenuItemImage *item = dynamic_cast<CCMenuItemImage *>(object); switch (item->getTag() case 1: mod

17、el=JINGDIAN; break; case 2: model=CHAN; break; case 3: model=JIEJI; break; default: break; CCScene *pScene = MainScene:scene(model); CCDirector:sharedDirector()->replaceScene(pScene); void FirstScene:toShangDian() CCScene *pScene = ShangdianScene:scene(1); CCDirector:sharedDirector()->replaceS

18、cene(pScene);2、游戲模塊設(shè)計(jì)代碼/ Block.h/ whiteBlock/ Created by liuqingyun on 14-12-5./#ifndef _whiteBlock_Block_#define _whiteBlock_Block_#include "cocos2d.h"USING_NS_CC;class Block : public cocos2d:CCSpritepublic: Block(); Block(); static Block* createWithArgs(int i, CCSize size); virtual bool

19、init(); void setBlockColor(int color); int getLineIndex(); void setLineIndex(int index); int returnColor(); bool getpass(); void setpass(); CREATE_FUNC(Block);private: void initWithArgs(int i, CCSize size);private: CCLayerColor* blockColor; int lineIndex; int colorIndex; bool pass;#endif /* defined(

20、_whiteBlock_Block_) */ Block.cpp/ whiteBlock/ Created by liuqingyun on 14-12-5./#include "Block.h"#include "Define.h"using namespace cocos2d;Block:Block():blockColor(NULL),pass(false)Block:Block()Block* Block:createWithArgs(int i, CCSize size) Block* b=new Block(); if (b&&

21、;b->init() b->autorelease(); b->initWithArgs(i, size); return b; CC_SAFE_DELETE(b); return NULL;bool Block:init() if(!CCSprite:init() return false; return true;void Block:initWithArgs(int i, CCSize size) colorIndex=i; if (i=WHITE) colorIndex=1; blockColor = CCLayerColor:create(ccc4(255, 255

22、, 255, 255), size.width, size.height); if (i=BLACK) colorIndex=2; blockColor = CCLayerColor:create(ccc4(15, 15, 15, 255), size.width, size.height); if (i=BLUE) colorIndex=3; blockColor = CCLayerColor:create(ccc4(0, 0, 255, 255), size.width, size.height); if (i=GREY) colorIndex=6; blockColor = CCLaye

23、rColor:create(ccc4(152, 155, 153, 255), size.width, size.height); if (i=GREEN) colorIndex=4; blockColor = CCLayerColor:create(ccc4(0, 255, 0, 255), size.width, size.height); if (i=RED) colorIndex=5; blockColor = CCLayerColor:create(ccc4(255, 0, 0, 255), size.width, size.height); blockColor->setAn

24、chorPoint(ccp(0.5, 0.5); blockColor->setPosition(ccp(this->getContentSize().width/2, this->getContentSize().height/2); addChild(blockColor);void Block:setBlockColor(int color) if (color=BLUE) colorIndex=3; blockColor->setColor(ccc3(0, 0, 255); else if (color=GREEN) colorIndex=4; blockCol

25、or->setColor(ccc3(0, 255, 0); else if (color=RED) colorIndex=5; blockColor->setColor(ccc3(255, 0, 0); else if (color=GREY) colorIndex=6; blockColor->setColor(ccc3(152, 155, 153); else if (color=BLACK) colorIndex=2; blockColor->setColor(ccc3(15, 15, 15); else if (color=WHITE) colorIndex=1

26、; blockColor->setColor(ccc3(255, 255, 255); int Block:returnColor() return colorIndex;int Block:getLineIndex() return lineIndex;void Block:setLineIndex(int index) lineIndex=index;bool Block:getpass() return pass;void Block:setpass() pass=true;3、游戲戰(zhàn)斗界面代碼/ MainScene.h/ whiteBlock/ Created by liuqin

27、gyun on 14-12-5./#ifndef _whiteBlock_MainScene_#define _whiteBlock_MainScene_#include "cocos2d.h"#include "Block.h"USING_NS_CC;class MainScene : public cocos2d:CCLayerpublic: MainScene(); MainScene(); virtual bool init(int i); static cocos2d:CCScene* scene(int i); virtual bool cc

28、TouchBegan(CCTouch *pTouch, CCEvent *pEvent); virtual void registerWithTouchDispatcher(void);private: void enemyInit(); void addNormalLine(int lineIndex); void addEndLine(); void startGame(); void moveDown(); void moveUp(float offset); void schedulemoveDown(); void blockSetPositionX(Block* block); v

29、oid startTime();void timeUpdate();/void trueTouchUpdate(); void blockMoveDown(Block* b);void judge(Block* block);/void gameOver(); void replaceScene(); void relive(); void wrong(); void beginCountdown(); void countdownSeconds(); void doCountdownAnimation(CCNode *node); void countdonwDone(CCNode* nod

30、e); virtual void keyBackClicked(); void queding(); void quxiao(); void jingdianTouch(CCTouch *pTouch); void chanTouch(CCTouch *pTouch); void jiejiTouch(CCTouch *pTouch); void buyLibao(); void toShangDian(); void pauseScene();private:/ CCArray* array; Block* array4; CCNode* timeNode; CCArray* blockAr

31、ray; CCSprite* pauseSprite; CCLabelTTF* timeLabel; CCLabelTTF* trueTouchLabel; CCLabelTTF* goldLabel; CCLabelTTF* goleCount; Block* endLine; CCSprite* dibanSprite; CCSprite* tuichuSprite; CCSprite* libaoSprite; CCMenu* tuichumenu; CCMenu* libaoMenu; int gameModel; int linesCount; int trueTouchCount;

32、 int bigLineIndex; int reliveIndex; long beginTime; bool timeRunning; bool success; bool pause; float speed; float timeIndex; ;#endif/ MainScene.cpp/ whiteBlock/ Created by liuqingyun on 14-12-5./#include "MainScene.h"#include "Block.h"#include "Define.h"#include "

33、UserData.h"#include "LastScene.h"#include "FirstScene.h"#include "ShangdianScene.h"#include "cocos-ext.h"#if (CC_TARGET_PLATFORM = CC_PLATFORM_ANDROID)#include <jni.h>#include "platform/android/jni/JniHelper.h"#include <android/log.h>

34、;#endifMainScene:MainScene():timeLabel(NULL),pauseSprite(NULL),timeRunning(false),endLine(NULL),success(true),trueTouchCount(0),bigLineIndex(0),speed(8.0),timeIndex(0.1),linesCount(0),timeNode(NULL),reliveIndex(0),pause(false) blockArray=new CCArray(); blockArray->retain(); for (int i=0; i<4;

35、i+) arrayi=NULL; MainScene:MainScene() CC_SAFE_DELETE(blockArray);CCScene* MainScene:scene(int i) CCScene *scene = CCScene:create(); MainScene *layer = new MainScene; if (layer&&layer->init(i) layer->autorelease(); else CC_SAFE_DELETE(layer); layer=NULL; scene->addChild(layer); retu

36、rn scene;bool MainScene:init(int i) if ( !CCLayer:init() ) return false; CCSize size=CCDirector:sharedDirector()->getWinSize(); gameModel = i; timeNode = CCNode:create(); addChild(timeNode,15); enemyInit(); this->setTouchEnabled(true); tuichuSprite=CCSprite:create("tuichuBoard.png");

37、 tuichuSprite->setPosition(ccp(size.width/2, size.height/2); tuichuSprite->setVisible(false); addChild(tuichuSprite); CCMenuItemImage *pQuedingItem = CCMenuItemImage:create( "queding.png", "queding.png", this, menu_selector(MainScene:queding); pQuedingItem->setPosition(c

38、cp(tuichuSprite->getContentSize().width/4,50); CCMenuItemImage *pQuxiaoItem = CCMenuItemImage:create( "quxiao.png", "quxiao.png", this, menu_selector(MainScene:quxiao); pQuxiaoItem->setPosition(ccp(tuichuSprite->getContentSize().width/4*3,50); tuichumenu = CCMenu:create(

39、pQuedingItem,pQuxiaoItem, NULL); tuichumenu->setPosition(CCPointZero); tuichuSprite->addChild(tuichumenu); / setKeypadEnabled(true); return true;void MainScene:keyBackClicked() tuichuSprite->setVisible(true); this->pauseSchedulerAndActions();void MainScene:queding() CCDirector:sharedDire

40、ctor()->end();void MainScene:quxiao() tuichuSprite->setVisible(false); this->resumeSchedulerAndActions();void MainScene:enemyInit() cc_timeval psv;CCTime:gettimeofdayCocos2d( &psv, NULL ); unsigned int tsrans = psv.tv_sec * 1000 + psv.tv_usec / 1000; srand( tsrans ); CCSize size=CCDirec

41、tor:sharedDirector()->getWinSize(); /Time timeLabel = CCLabelTTF:create(); timeLabel->setColor(ccc3(255, 0, 0); timeLabel->setFontSize(50); timeLabel->setString("0.0000"); timeLabel->setPosition(ccp(size.width/2, size.height-80); addChild(timeLabel,TIMETAG); /trueTouchLabel

42、trueTouchLabel = CCLabelTTF:create(); trueTouchLabel->setColor(ccc3(255, 0, 0); trueTouchLabel->setFontSize(50); trueTouchLabel->setString("0"); trueTouchLabel->setPosition(ccp(size.width/2, size.height-120); addChild(trueTouchLabel,TIMETAG); pauseSprite = CCSprite:create("

43、;reliveBoard.png"); pauseSprite->setPosition(ccp(size.width/2, size.height/2); pauseSprite->setVisible(false); addChild(pauseSprite,6); goleCount = CCLabelTTF:create("200", "Arial", 24); goleCount->setPosition(ccp(pauseSprite->getContentSize().width/2, 40); pause

44、Sprite->addChild(goleCount); CCMenuItemImage* reliveImage=CCMenuItemImage:create( "fuhuo.png", "fuhuo.png", this, menu_selector(MainScene:relive); reliveImage->setPosition(ccp(pauseSprite->getContentSize().width/2,pauseSprite->getContentSize().height/2-20); CCMenuItem

45、Image* deadImage=CCMenuItemImage:create( "cha.png", "cha.png", this, menu_selector(MainScene:gameOver); deadImage->setPosition(ccp(pauseSprite->getContentSize().width-20,pauseSprite->getContentSize().height-20); CCMenu* reliveMenu=CCMenu:create(reliveImage,deadImage, NUL

46、L); reliveMenu->setPosition(CCPointZero); pauseSprite->addChild(reliveMenu); if (gameModel=JINGDIAN) timeLabel->setVisible(true); trueTouchLabel->setVisible(false); else if (gameModel=CHAN) timeLabel->setVisible(true); trueTouchLabel->setVisible(true); timeLabel->setString("20.0000"); else if (gameModel=JIEJI) timeLabel->set

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論