《别踩白块经典版》设计说明文档1.docx
《《别踩白块经典版》设计说明文档1.docx》由会员分享,可在线阅读,更多相关《《别踩白块经典版》设计说明文档1.docx(52页珍藏版)》请在冰豆网上搜索。
![《别踩白块经典版》设计说明文档1.docx](https://file1.bdocx.com/fileroot1/2023-1/28/3d85bcf0-f814-4945-a574-5646149a39fb/3d85bcf0-f814-4945-a574-5646149a39fb1.gif)
《别踩白块经典版》设计说明文档1
《别踩白块2015经典版》设计说明版本号:
V1.0
一、设计原理:
一款休闲类游戏,依靠玩家反应能力获得更多的黑块。
针对碎片时间较多、对反应能力有自信的人。
整个页面由黑白两种色块组成,页面分为4列,4列中每一行随机刷新一个黑块,玩家需要依次点击刷新的黑块才能继续游戏,漏点或点击白块后判定失败。
二、设计流程:
游戏模式:
游戏模式主要有3种,经典模式、禅模式、街机模式。
经典模式:
以最快的速度准确的完成50块黑块的收集。
胜负判定:
玩家准确收集完50个黑块,判定胜利并记录时间;玩家点击了白块则判定失败。
禅模式:
在规定的时间内(30s)尽可能的收集黑块。
胜负判定:
玩家在30s内准确的收集黑块,记录收集的黑块数量;玩家点击白块则判定失败。
街机模式:
屏幕会以一定的速度(速度会逐渐上升)向下刷新黑白块,玩家必须准确点击黑块。
胜负判定:
玩家点击白块或漏点黑块则判定玩家失败,记录当前收集黑块数。
设计流程图:
经典模式
禅模式
街机模式
道具
道具名称
描述
概率(暂定)
价格(暂定)
复活
玩家死亡后可复活继续游戏,复活后有3秒准备时间
100%
200钻石
三、UI设计说明:
界面关系流程图:
主界面:
战斗界面:
商城界面:
复活界面:
结算界面
礼包界面:
四、软件架构图
五、算法
1、游戏首界面代码#ifndef__whiteBlock__FirstScene__
#define__whiteBlock__FirstScene__
#include"cocos2d.h"
USING_NS_CC;
classFirstScene:
publiccocos2d:
:
CCLayer
{
public:
FirstScene();
~FirstScene();
virtualboolinit();
staticcocos2d:
:
CCScene*scene();
voidreplaceScene(CCObject*objectz);
virtualvoidkeyBackClicked();
voidqueding();
voidquxiao();
voidtoShangDian();
CREATE_FUNC(FirstScene);
private:
intmodel;
CCMenu*replaceSceneMenu;
CCSprite*tuichuSprite;
CCMenu*tuichumenu;
CCLabelTTF*goldLabel;
};
#endif/*defined(__whiteBlock__FirstScene__)*/
//FirstScene.cpp
//whiteBlock
//Createdbyliuqingyunon14-12-7.
//
//
#include"FirstScene.h"
#include"MainScene.h"
#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);
returnscene;
}
boolFirstScene:
:
init()
{
if(!
CCLayer:
:
init())
{
returnfalse;
}
CCSizesize=CCDirector:
:
sharedDirector()->getWinSize();
CCSprite*baoshi=CCSprite:
:
create("zhuangshi.png");
baoshi->setPosition(ccp(50,size.height-50));
addChild(baoshi);
intbaoshishuliang=UserData:
:
getIntegerForKey(GOLD);
CCLog("baoshishuliangis%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,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=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,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(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=CCMenuItemImage:
:
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);
replaceSceneMenu->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:
:
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_selector(FirstScene:
:
quxiao));
pQuxiaoItem->setPosition(ccp(tuichuSprite->getContentSize().width/4*3,50));
tuichumenu=CCMenu:
:
create(pQuedingItem,pQuxiaoItem,NULL);
tuichumenu->setPosition(CCPointZero);
tuichuSprite->addChild(tuichumenu);
returntrue;
}
voidFirstScene:
:
keyBackClicked()
{
tuichuSprite->setVisible(true);
}
voidFirstScene:
:
queding()
{
CCDirector:
:
sharedDirector()->end();
}
voidFirstScene:
:
quxiao()
{
tuichuSprite->setVisible(false);
}
voidFirstScene:
:
replaceScene(CCObject*object)
{
CCMenuItemImage*item=dynamic_cast(object);
switch(item->getTag())
{
case1:
model=JINGDIAN;
break;
case2:
model=CHAN;
break;
case3:
model=JIEJI;
break;
default:
break;
}
CCScene*pScene=MainScene:
:
scene(model);
CCDirector:
:
sharedDirector()->replaceScene(pScene);
}
voidFirstScene:
:
toShangDian()
{
CCScene*pScene=ShangdianScene:
:
scene
(1);
CCDirector:
:
sharedDirector()->replaceScene(pScene);
}
2、游戏模块设计代码
//Block.h
//whiteBlock
//
//Createdbyliuqingyunon14-12-5.
//
//
#ifndef__whiteBlock__Block__
#define__whiteBlock__Block__
#include"cocos2d.h"
USING_NS_CC;
classBlock:
publiccocos2d:
:
CCSprite
{
public:
Block();
~Block();
staticBlock*createWithArgs(inti,CCSizesize);
virtualboolinit();
voidsetBlockColor(intcolor);
intgetLineIndex();
voidsetLineIndex(intindex);
intreturnColor();
boolgetpass();
voidsetpass();
CREATE_FUNC(Block);
private:
voidinitWithArgs(inti,CCSizesize);
private:
CCLayerColor*blockColor;
intlineIndex;
intcolorIndex;
boolpass;
};
#endif/*defined(__whiteBlock__Block__)*/
//Block.cpp
//whiteBlock
//
//Createdbyliuqingyunon14-12-5.
//
//
#include"Block.h"
#include"Define.h"
usingnamespacecocos2d;
Block:
:
Block()
:
blockColor(NULL)
pass(false)
{
}
Block:
:
~Block()
{
}
Block*Block:
:
createWithArgs(inti,CCSizesize)
{
Block*b=newBlock();
if(b&&b->init()){
b->autorelease();
b->initWithArgs(i,size);
returnb;
}
CC_SAFE_DELETE(b);
returnNULL;
}
boolBlock:
:
init()
{
if(!
CCSprite:
:
init())
{
returnfalse;
}
returntrue;
}
voidBlock:
:
initWithArgs(inti,CCSizesize)
{
colorIndex=i;
if(i==WHITE){
colorIndex=1;
blockColor=CCLayerColor:
:
create(ccc4(255,255,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=CCLayerColor:
:
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->setAnchorPoint(ccp(0.5,0.5));
blockColor->setPosition(ccp(this->getContentSize().width/2,this->getContentSize().height/2));
addChild(blockColor);
}
voidBlock:
:
setBlockColor(intcolor)
{
if(color==BLUE){
colorIndex=3;
blockColor->setColor(ccc3(0,0,255));
}
elseif(color==GREEN){
colorIndex=4;
blockColor->setColor(ccc3(0,255,0));
}
elseif(color==RED){
colorIndex=5;
blockColor->setColor(ccc3(255,0,0));
}
elseif(color==GREY){
colorIndex=6;
blockColor->setColor(ccc3(152,155,153));
}
elseif(color==BLACK){
colorIndex=2;
blockColor->setColor(ccc3(15,15,15));
}
elseif(color==WHITE){
colorIndex=1;
blockColor->setColor(ccc3(255,255,255));
}
}
intBlock:
:
returnColor()
{
returncolorIndex;
}
intBlock:
:
getLineIndex()
{
returnlineIndex;
}
voidBlock:
:
setLineIndex(intindex)
{
lineIndex=index;
}
boolBlock:
:
getpass()
{
returnpass;
}
voidBlock:
:
setpass()
{
pass=true;
}
3、游戏战斗界面代码
//MainScene.h
//whiteBlock
//
//Createdbyliuqingyunon14-12-5.
//
//
#ifndef__whiteBlock__MainScene__
#define__whiteBlock__MainScene__
#include"cocos2d.h"
#include"Block.h"
USING_NS_CC;
classMainScene:
publiccocos2d:
:
CCLayer
{
public:
MainScene();
~MainScene();
virtualboolinit(inti);
staticcocos2d:
:
CCScene*scene(inti);
virtualboolccTouchBegan(CCTouch*pTouch,CCEvent*pEvent);
virtualvoidregisterWithTouchDispatcher(void);
private:
voidenemyInit();
voidaddNormalLine(intlineIndex);
voidaddEndLine();
voidstartGame();
voidmoveDown();
voidmoveUp(floatoffset);
voidschedulemoveDown();
voidblockSetPositionX(Block*block);
voidstartTime();
voidtimeUpdate();//
voidtrueTouchUpdate();
voidblockMoveDown(Block*b);
voidjudge(Block*block);//
voidgameOver();
voidreplaceScene();
voidrelive();
voidwrong();
voidbeginCountdown();
voidcountdownSeconds();
voiddoCountdownAnimation(CCNode*node);
voidcountdonwDone(CCNode*node);
virtualvoidkeyBackClicked();
voidqueding();
voidquxiao();
voidjingdianTouch(CCTouch*pTouch);
voidchanTouch(CCTouch*pTouch);
voidjiejiTouch(CCTouch*pTouch);
voidbuyLibao();
voidtoShangDian();
voidpauseScene();
private:
//CCArray*array;
Block*array[4];
CCNode*timeNode;
CCArray*blockArray;
CCSprite*pauseSprite;
CCLabelTTF*timeLabel;
CCLabelTTF*trueTouchLabel;
CCLabelTTF*goldLabel;
CCLabelTTF*goleCount;
Block*endLine;
CCSprite*dibanSprite;
CCSprite*tuichuSprite;
CCSprite*libaoSprite;
CCMenu*tuichumenu;
CCMenu*libaoMenu;
intgameModel;
intlinesCount;
inttrue