




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、別踩白塊2015經(jīng)典版設(shè)計(jì)說明版本號:V1.0 一、設(shè)計(jì)原理: 一款休閑類游戲,依靠玩家反應(yīng)能力獲得更多的黑塊。 針對碎片時間較多、對反應(yīng)能力有自信的人。整個頁面由黑白兩種色塊組成,頁面分為4列,4列中每一行隨機(jī)刷新一個黑塊,玩家需要依次點(diǎn)擊刷新的黑塊才能繼續(xù)游戲,漏點(diǎn)或點(diǎn)擊白塊后判定失敗。二、設(shè)計(jì)流程:游戲模式:游戲模式主要有3種,經(jīng)典模式、禪模式、街機(jī)模式。經(jīng)典模式:以最快的速度準(zhǔn)確的完成50塊黑塊的收集。勝負(fù)判定:玩家準(zhǔn)確收集完50個黑塊,判定勝利并記錄時間;玩家點(diǎn)擊了白塊則判定失敗。禪模式: 在規(guī)定的時間內(nèi)(30s)盡可能的收集黑塊。勝負(fù)判定:玩家在30s內(nèi)準(zhǔn)確的收集黑塊,記錄收集的黑
2、塊數(shù)量;玩家點(diǎn)擊白塊則判定失敗。街機(jī)模式:屏幕會以一定的速度(速度會逐漸上升)向下刷新黑白塊,玩家必須準(zhǔn)確點(diǎn)擊黑塊。勝負(fù)判定:玩家點(diǎn)擊白塊或漏點(diǎn)黑塊則判定玩家失敗,記錄當(dāng)前收集黑塊數(shù)。 設(shè)計(jì)流程圖:經(jīng)典模式 禪模式街機(jī)模式道具道具名稱描述概率(暫定)價格(暫定)復(fù)活玩家死亡后可復(fù)活繼續(xù)游戲,復(fù)活后有3秒準(zhǔn)備時間100%200鉆石三、UI設(shè)計(jì)說明: 界面關(guān)系流程圖: 主界面:戰(zhàn)斗界面:商城界面: 復(fù)活界面: 結(jié)算界面禮包界面: 四、 軟件架構(gòu)圖五、 算法1、游戲首界面代碼#ifndef _whiteBlock_FirstScene_#define _whiteBlock_FirstScene_#
3、include "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_F
4、UNC(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&quo
5、t;#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); r
6、eturn 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:getIntegerForKe
7、y(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* pMenu
9、1 = 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(
11、CHAN); 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 = CCMenuIt
12、emImage: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); replaceScene
13、Menu->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 = CCMenuItemImag
14、e: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_select
15、or(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: mo
17、del=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()->replace
18、Scene(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&&am
21、p;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, 25
22、5, 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 = CCLay
23、erColor: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->setA
24、nchorPoint(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; blockCo
25、lor->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=
26、1; 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 liuqi
27、ngyun 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 c
28、cTouchBegan(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);
29、void 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* no
30、de); 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* blockA
31、rray; 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&g
34、t;#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); ret
36、urn 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(
38、ccp(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:sharedDir
40、ector()->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=CCDire
41、ctor: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(&quo
43、t;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); paus
44、eSprite->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); CCMenuIte
45、mImage* 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, NU
46、LL); 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.000
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度貨運(yùn)安全與環(huán)保補(bǔ)充協(xié)議
- 2025年度能源行業(yè)數(shù)據(jù)保密協(xié)議書
- 二零二五年度物流園區(qū)出租車位租賃與倉儲物流合同
- 2025年度新能源項(xiàng)目采購合同評審流程圖
- 二零二五年度個人出租車旅游專線承包協(xié)議
- 2025年度足浴店員工薪資保底發(fā)放與員工績效獎金制度合同
- 2025年度果樹綠色生產(chǎn)技術(shù)與市場拓展合作協(xié)議
- 二零二五年度按摩養(yǎng)生館品牌加盟合同范文
- 二零二五年度商業(yè)街區(qū)立體停車場租賃合同范本
- 2025年度林地經(jīng)營權(quán)流轉(zhuǎn)與林業(yè)產(chǎn)業(yè)發(fā)展合同協(xié)議
- CJT340-2016 綠化種植土壤
- 高考志愿填報(bào)的志愿填報(bào)專業(yè)指導(dǎo)
- DL-T5024-2020電力工程地基處理技術(shù)規(guī)程
- 2024年互聯(lián)網(wǎng)法律法規(guī)知識考試題庫(附答案)
- 《第十九課 巧妙地化解沖突》教學(xué)設(shè)計(jì) 七年級全一冊
- 2024年內(nèi)蒙古商貿(mào)職業(yè)學(xué)院單招職業(yè)適應(yīng)性測試題庫及答案解析
- 福建省建筑幕墻工程質(zhì)量驗(yàn)收規(guī)程
- 2024年新疆昌吉英格瑪煤電投資有限責(zé)任公司招聘筆試參考題庫含答案解析
- 2024年云南省昆明市中考一模英語試題(含答案)
- 設(shè)備采購供貨安裝實(shí)施供貨安全保障措施
- (高清版)TDT 1013-2013 土地整治項(xiàng)目驗(yàn)收規(guī)程
評論
0/150
提交評論