别踩白块设计说明文档_第1页
别踩白块设计说明文档_第2页
别踩白块设计说明文档_第3页
别踩白块设计说明文档_第4页
别踩白块设计说明文档_第5页
已阅读5页,还剩34页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、别踩白块2015经典版设计说明版本号:V1.0 一、设计原理: 一款休闲类游戏,依靠玩家反应能力获得更多的黑块。 针对碎片时间较多、对反应能力有自信的人。整个页面由黑白两种色块组成,页面分为4列,4列中每一行随机刷新一个黑块,玩家需要依次点击刷新的黑块才能继续游戏,漏点或点击白块后判定失败。二、设计流程:游戏模式:游戏模式主要有3种,经典模式、禅模式、街机模式。经典模式:以最快的速度准确的完成50块黑块的收集。胜负判定:玩家准确收集完50个黑块,判定胜利并记录时间;玩家点击了白块则判定失败。禅模式: 在规定的时间内(30s)尽可能的收集黑块。胜负判定:玩家在30s内准确的收集黑块,记录收集的黑

2、块数量;玩家点击白块则判定失败。街机模式:屏幕会以一定的速度(速度会逐渐上升)向下刷新黑白块,玩家必须准确点击黑块。胜负判定:玩家点击白块或漏点黑块则判定玩家失败,记录当前收集黑块数。设计流程图:经典模式 禅模式街机模式道具道具名称描述概率(暂定)价格(暂定)复活玩家死亡后可复活继续游戏,复活后有3秒准备时间100%200钻石三、UI设计说明: 界面关系流程图: 主界面:战斗界面:商城界面: 复活界面: 结算界面礼包界面: 四、 软件架构图五、 算法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、游戏模块设计代码/ 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、游戏战斗界面代码/ 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. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论