C语言产品计划报告书.docx_第1页
C语言产品计划报告书.docx_第2页
C语言产品计划报告书.docx_第3页
C语言产品计划报告书.docx_第4页
C语言产品计划报告书.docx_第5页
已阅读5页,还剩108页未读 继续免费阅读

下载本文档

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

文档简介

C语言弹弹乐产品计划报告书设计名称:弹弹乐专 业:软件工程班 级:1418姓 名:XX学 号:14621418XX指导老师:王若慧目 录1) 选题背景与意义2) 需求分析3) 开发环境4) 总体设计5) 源代码6) 心得体会一、选题背景与意义随着编程语言的不断发展,游戏发展速度越来越快,游戏已经成为现在人生活娱乐,打发时间,缓解压力的一项不可或缺的项目。而一个优秀的游戏离不开游戏画面、程序脚本以及后期音效的共同作用。因此,越来越多有着引人入胜的剧情,丰富有趣的画面,好听难忘的音乐的小游戏在互联网上被越来越多的玩家喜爱和分享。当这些兼具艺术性与流行性的元素都由一个游戏组合到一起,人们可以从中得到娱乐和放松,同时有得到一些对生活对人生的启发,让人会心一笑。而创作者也可以选择不同的风格,不同的手法用计算机的一系列数码艺术创作手法实现自己的创意,然后在一些交流互动网站上发表,供他人娱乐或者借鉴,同时也可以得到广大互联网用户的意见,从而提高自身的创作水品。由此可见,游戏设计的意义就在于:集合不同的艺术门类,把艺术与技术相结合。从而让人可以在游戏中的到美的享受。给广大的互联网用户提供了一个娱乐,休闲,放松身心的地方。让设计师之与玩家之间产生交流,从而完善游戏。操作便捷,文件携带方便,无需安装,符合了现在很多快餐式的生活要求便于大众随时的下载,游戏。有丰富的图像,画面不受软件的限制。富有创意,风格多变。是其他电子游戏没有的。国内外研究现状及分析:目前利用开发出了许多夸平台的网络游戏,甚至可以匹敌大型MMOR,在3G时代到来以后,我们很快可以在手机上玩到大型网络游戏,现有的制作网络游戏有:SLG类(热血三国),体育类(热血球球),RPG类(凡人修真),桌面(德州扑克),TD类(保卫家园)等等.在日本和美国,动画和游戏这一类的技术超出国内比较多,日本的动漫位居世界前列是众所周知的。二、需求分析1:功能的需求弹弹乐游戏是个简单的小游戏能让游戏者的身心得到娱乐从而能够更好地投入到学习或工作当中虽然现在市面上出来这各种各样的游戏版本可是弹弹乐这类的小游戏其市场还是相当大的因为它玩法简单易行不论是手机还是小游戏机都能很顺利的运行对于在外忙碌的人不可能花费大量时间在娱乐上大型游戏是行不通的这样的小游戏刚好迎合了他们的需求。2:操作方法2.1进入游戏2.2游戏界面2.3游戏操作2.4游戏结束三、开发环境1:设计任务与需要的知识点1)通过编写弹弹乐游戏程序掌握结构化模块块化程序设计的思想培养解决实际问题的能力2)有同步播放动画声音效果2:具体完成设计内容本次课程设计需要掌握和运用如下的知识点:1数组的应用2全局变量的使用3按键处理4结构体的应用5图形音乐和动画的有关知识四、总体设计4.1 设计思路这里我们首先构建一个游戏框架,然后再编写各个模块,最后组成一个完整的游戏4.2 框架五、源代码#include #include #include #include #include #include #include #pragma comment(lib,winmm.lib)#define LEFT 1 #define RIGHT 30#define TOP 1#define BUTTON 22 /=/ 自定义结构体typedef struct POINT/点int x;int y;Point;struct BALL/球int x;int y;int x_Speed;int y_Speed;int mode;/0-普通;1-实心;2-冰霜;Ball3;struct BORD/板int x;int y;int length;/长度Bord;struct TREASURE/宝石int x;int y;int type;Treasure;enum color green,blue,red ;enum mode run_Game,creat_Map ;/=/ 自定义函数的声明void gotoxy(int x, int y);int mainGame();/主函数void initGame(int mode);/初始化游戏void runGame();/运行游戏void creatMap();/制作地图void helpGame();/游戏帮助void selectMap();/选择地图void playGame();/游戏完成时int checkComplete();/检测游戏是否完成void PrintBord();/绘制木板和小球void PrintLev();/初始化相关关卡void MoveBord(int orientation);/移动木板void MoveBall(int index);/移动小球void removeDiamond(int index,int direction);/移除方块void removeColor(enum color,Point diamond);/解决颜色void showTreasure(int intRand,Point point_diamond);/宝物void move_Treasure();/移动宝石void get_Treasure();/获得宝石void time_Treasure();/宝石失效/=/自定义全局变量、全局常量HANDLE g_hConsoleOutput; / 获取控制台输出句柄short potVal4030;/0空白,11级方块,22级方块,33级方块,4围墙int live=1;/生命int stop=0;/0-不暂停,1-暂停int speed=1000;/速度int intGrade=0;/分数int intTreasure=0;/宝石数int getTreasure=0;/获得宝石int level_Now=0;/当前关卡int level_Max=0;/关卡数量char fileName10020;/目前设置最高地图容量为100个char game_Map20;/游戏地图clock_t treaTime_Last,treaTime_Now;/宝物持续时间static const char* BALL_SHAPE=,;/ =/ 主菜单int main() g_hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE); / 获取控制台输出句柄SetConsoleTitleA(弹弹乐-By : shw);/ char chVolume256;/ long lVolume;/ mciSendString(status movie volume,chVolume,255,0);/ lVolume=strtol(chVolume,NULL,10);mciSendString(play musicbg_music.mp3 repeat ,NULL, 0,NULL);/背景音乐mciSendString (setaudio musicbg_music.mp3 volume to 100,NULL,0,NULL);/设置音量doCONSOLE_CURSOR_INFO cursorInfo = 1, FALSE ; / 光标信息SetConsoleCursorInfo(g_hConsoleOutput, &cursorInfo); / 设置光标隐藏switch(mainGame()/游戏选项case 0:playGame();break;case 1:creatMap();break;case 2:helpGame();break;case 3:selectMap();playGame();break;while(1);system(pausenul);return 0;/ =/ 主菜单int mainGame()FILE *fMap;int ch,index=0;static const char *modeItem=开始游戏,制作关卡,游戏帮助,选择关卡;system(cls);SetConsoleTextAttribute(g_hConsoleOutput,FOREGROUND_GREEN|FOREGROUND_INTENSITY); gotoxy(15, 5); printf(); gotoxy(15, 6); printf(%2s%s%2s, , 弹弹乐, ); gotoxy(15, 7); printf();SetConsoleTextAttribute(g_hConsoleOutput, 0xF0);gotoxy(16, 14);printf(%2s%s%2s, , modeItem0, );SetConsoleTextAttribute(g_hConsoleOutput, 0x0F);gotoxy(16, 16);printf(%2s%s%2s, , modeItem1, );SetConsoleTextAttribute(g_hConsoleOutput, 0x0F);gotoxy(16, 18);printf(%2s%s%2s, , modeItem2, );SetConsoleTextAttribute(g_hConsoleOutput, 0x0F);gotoxy(16, 20);printf(%2s%s%2s, , modeItem3, );if(fMap=fopen(mapsMapInfo.dat,r)=NULL)gotoxy(LEFT+4,TOP+2);printf(打开地图信息文件发生错误!);gotoxy(LEFT+4,TOP+4);printf(请查看MapInfo.dat文件是否存在!);exit(0);while(fgets(fileNamelevel_Max,20,fMap)!=NULL)if(fileNamelevel_Maxstrlen(fileNamelevel_Max)-1=n)fileNamelevel_Maxstrlen(fileNamelevel_Max)-1=0;level_Max+;fclose(fMap);level_Now=0;/默认第一个地图do ch = getch(); switch (ch) case s: case S: case 2: case 80: / 下if(index=0) index = 1; SetConsoleTextAttribute(g_hConsoleOutput, 0x0F); gotoxy(16, 14); printf(%2s%s%2s, , modeItem0, ); SetConsoleTextAttribute(g_hConsoleOutput, 0xF0); gotoxy(16, 16); printf(%2s%s%2s, , modeItem1, ); else if(index = 1) index = 2; SetConsoleTextAttribute(g_hConsoleOutput, 0x0F); gotoxy(16, 16); printf(%2s%s%2s, , modeItem1, ); SetConsoleTextAttribute(g_hConsoleOutput, 0xF0); gotoxy(16, 18); printf(%2s%s%2s, , modeItem2, ); else if(index=2)index = 3;SetConsoleTextAttribute(g_hConsoleOutput, 0xF0);gotoxy(16, 20);printf(%2s%s%2s, , modeItem3, );SetConsoleTextAttribute(g_hConsoleOutput, 0x0F);gotoxy(16, 18);printf(%2s%s%2s, , modeItem2, );else if(index=3)index = 0;SetConsoleTextAttribute(g_hConsoleOutput, 0xF0);gotoxy(16, 14);printf(%2s%s%2s, , modeItem0, );SetConsoleTextAttribute(g_hConsoleOutput, 0x0F);gotoxy(16, 20);printf(%2s%s%2s, , modeItem3, );break;case w: case W: case 8: case 72: / 上if(index=0) index = 3; SetConsoleTextAttribute(g_hConsoleOutput, 0x0F); gotoxy(16, 14); printf(%2s%s%2s, , modeItem0, ); SetConsoleTextAttribute(g_hConsoleOutput, 0xF0); gotoxy(16, 20); printf(%2s%s%2s, , modeItem3, ); else if(index = 1) index = 0; SetConsoleTextAttribute(g_hConsoleOutput, 0xF0); gotoxy(16, 14); printf(%2s%s%2s, , modeItem0, ); SetConsoleTextAttribute(g_hConsoleOutput, 0x0F); gotoxy(16, 16); printf(%2s%s%2s, , modeItem1, ); else if(index=2)index = 1;SetConsoleTextAttribute(g_hConsoleOutput, 0xF0);gotoxy(16, 16);printf(%2s%s%2s, , modeItem1, );SetConsoleTextAttribute(g_hConsoleOutput, 0x0F);gotoxy(16, 18);printf(%2s%s%2s, , modeItem2, );else if(index=3)index = 2;SetConsoleTextAttribute(g_hConsoleOutput, 0xF0);gotoxy(16, 18);printf(%2s%s%2s, , modeItem2, );SetConsoleTextAttribute(g_hConsoleOutput, 0x0F);gotoxy(16, 20);printf(%2s%s%2s, , modeItem3, ); break; case : case 13: return index;break; while(1);/=/ 以全角定位到某点void gotoxy(int x, int y) static COORD cd; cd.X = (int)(x 1); cd.Y = y; SetConsoleCursorPosition(g_hConsoleOutput, cd);/=/ 运行主程序void playGame()/游戏完成时char ch;do runGame(fileNamelevel_Now);if(level_Nowlevel_Max & checkComplete()level_Now+;gotoxy(LEFT+2,BUTTON-3);printf(恭喜你已经成功过关!);gotoxy(LEFT+2,BUTTON-2);printf(是否继续游戏? );elsebreak; while(ch=_getch()=13);/=/ 开始游戏void runGame()int ch;clock_t clockLast, clockNow;/游戏主进程clock_t treasureLast,treasureNow;/宝物下落过程 clockLast = treasureLast =clock(); / 计时initGame(run_Game);PrintLev(); / 绘制游戏方块while(live)while(!stop & live)while (_kbhit() / 有键按下ch = _getch();switch(ch)case 27: return;break;case a:case A:case 4: case 75:MoveBord(1);break;case d: case D: case 6: case 77:MoveBord(2);break;case 32:stop=1;clockNow = clock(); / 计时/ 两次记时的间隔超过0.45秒if (clockNow - clockLast 0.2F *speed)clockLast = clockNow;MoveBall(0);if(intTreasure=1)treasureNow=clock();if (treasureNow - treasureLast 0.5F * CLOCKS_PER_SEC)treasureLast = treasureNow;move_Treasure();if(getTreasure=1)treaTime_Now=clock();if(treaTime_Now-treaTime_Last 1.0F * CLOCKS_PER_SEC)if(treaTime_Now-treaTime_Last 1.1F * CLOCKS_PER_SEC)SetConsoleTextAttribute(g_hConsoleOutput,0x0F);gotoxy(LEFT+27,BUTTON-2);printf(%2s,);else if(treaTime_Now-treaTime_Last 2.1F * CLOCKS_PER_SEC)SetConsoleTextAttribute(g_hConsoleOutput,0x0F);gotoxy(LEFT+26,BUTTON-2);printf(%2s,);else if(treaTime_Now-treaTime_Last 3.1F * CLOCKS_PER_SEC)SetConsoleTextAttribute(g_hConsoleOutput,0x0F);gotoxy(LEFT+25,BUTTON-2);printf(%2s,);else if(treaTime_Now-treaTime_Last 4.1F * CLOCKS_PER_SEC)SetConsoleTextAttribute(g_hConsoleOutput,0x0F);gotoxy(LEFT+24,BUTTON-2);printf(%2s,);else if(treaTime_Now-treaTime_Last 5.1F * CLOCKS_PER_SEC)SetConsoleTextAttribute(g_hConsoleOutput,0x0F);gotoxy(LEFT+23,BUTTON-2);printf(%2s,);else if(treaTime_Now-treaTime_Last 6.1F * CLOCKS_PER_SEC)SetConsoleTextAttribute(g_hConsoleOutput,0x0F);gotoxy(LEFT+22,BUTTON-2);printf(%2s,);else if(treaTime_Now-treaTime_Last 7.1F * CLOCKS_PER_SEC)SetConsoleTextAttribute(g_hConsoleOutput,0x0F);gotoxy(LEFT+21,BUTTON-2);printf(%2s,);else if(treaTime_Now-treaTime_Last 8.1F * CLOCKS_PER_SEC)SetConsoleTextAttribute(g_hConsoleOutput,0x0F);gotoxy(LEFT+20,BUTTON-2);printf(%2s,);else if(treaTime_Now-treaTime_Last 9.1F * CLOCKS_PER_SEC)SetConsoleTextAttribute(g_hConsoleOutput,0x0F);gotoxy(LEFT+19,BUTTON-2);printf(%2s,);else if(treaTime_Now-treaTime_Last 10.1F * CLOCKS_PER_SEC)SetConsoleTextAttribute(g_hConsoleOutput,0x0F);gotoxy(LEFT+18,BUTTON-2);printf(%2s,);else if(treaTime_Now-treaTime_Last 11.1F * CLOCKS_PER_SEC)SetConsoleTextAttribute(g_hConsoleOutput,0x0F);gotoxy(LEFT+17,BUTTON-2);printf(%2s,);else if(treaTime_Now-treaTime_Last 12.1F * CLOCKS_PER_SEC)SetConsoleTextAttribute(g_hConsoleOutput,0x0F);gotoxy(LEFT+16,BUTTON-2);printf(%2s,);else if(treaTime_Now-treaTime_Last 13.1F * CLOCKS_PER_SEC)SetConsoleTextAttribute(g_hConsoleOutput,0x0F);gotoxy(LEFT+15,BUTTON-2);printf(%2s,);else if(treaTime_Now-treaTime_Last 14.1F * CLOCKS_PER_SEC)SetConsoleTextAttribute(g_hConsoleOutput,0x0F);gotoxy(LEFT+14,BUTTON-2);printf(%2s,);else if(treaTime_Now-treaTime_Last 15.1F * CLOCKS_PER_SEC)SetConsoleTextAttribute(g_hConsoleOutput,0x0F);gotoxy(LEFT+13,BUTTON-2);printf(%2s,);else if(treaTime_Now-treaTime_Last 16.1F * CLOCKS_PER_SEC)SetConsoleTextAttribute(g_hConsoleOutput,0x0F);gotoxy(LEFT+12,BUTTON-2);printf(%2s,);else if(treaTime_Now-treaTime_Last 17.1F * CLOCKS_PER_SEC)SetConsoleTextAttribute(g_hConsoleOutput,0x0F);gotoxy(LEFT+11,BUTTON-2);printf(%2s,);else if(treaTime_Now-treaTime_Last 18.1F * CLOCKS_PER_SEC)SetConsoleTextAttribute(g_hConsoleOutput,0x0F);gotoxy(LEFT+10,BUTTON-2);printf(%2s,);else if(treaTime_Now-treaTime_Last 19.1F * CLOCKS_PER_SEC)SetConsoleTextAttribute(g_hConsoleOutput,0x0F);gotoxy(LEFT+9,BUTTON-2);printf(%2s,);else if(treaTime_Now-treaTime_Last 20.1F * CLOCKS_PER_SEC)SetConsoleTextAttribute(g_hConsoleOutput,0x0F);gotoxy(LEFT+8,BUTTON-2);printf(%2s,);else if(treaTime_Now-treaTime_Last nul);/=/选择关卡void selectMap()FILE *fMap;char ch;level_Max=0;SetConsoleTextAttribute(g_hConsoleOutput,0x0F);system(cls);if(fMap=fopen(mapsMapInfo.dat,r)=NULL)gotoxy(LEFT+4,TOP+4);printf(打开地图信息文件发生错误!);gotoxy(LEFT+4,TOP+6);printf(请查看MapInfo.d

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论