收藏 分享(赏)

打飞机源代码.doc

上传人:tangtianxu1 文档编号:2928995 上传时间:2018-09-30 格式:DOC 页数:28 大小:18.10KB
下载 相关 举报
打飞机源代码.doc_第1页
第1页 / 共28页
打飞机源代码.doc_第2页
第2页 / 共28页
打飞机源代码.doc_第3页
第3页 / 共28页
打飞机源代码.doc_第4页
第4页 / 共28页
打飞机源代码.doc_第5页
第5页 / 共28页
点击查看更多>>
资源描述

1、#include#include#include#include#includeusing namespace std;/打飞机源码亲测可用/ all the structures =*/typedef struct FrameCOORD position2;int flag;Frame;/*= all the functions =*/void SetPos(COORD a)/ set cursor HANDLE out=GetStdHandle(STD_OUTPUT_HANDLE);SetConsoleCursorPosition(out, a);void SetPos(int i, in

2、t j)/ set cursorCOORD pos=i, j;SetPos(pos);void HideCursor()CONSOLE_CURSOR_INFO cursor_info = 1, 0; SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), /把第 y 行,x1, x2) 之间的坐标填充为 chvoid drawRow(int y, int x1, int x2, char ch)SetPos(x1,y);for(int i = 0; i =frame.position0.X)if(spot.X=frame.position0.

3、Y)if(spot.Y“;drawFrame(45, 9, 79, 17, =, |);while(1) if( _kbhit() )char x=_getch();switch (x)case w :if( j = 13)SetPos(12, j);cout“;SetPos(51, 13);cout“;SetPos(51, 13);cout= rank )flag_enemy = 0;/* 输出得分 */printScore();void Game:GameOver()system(“cls“);COORD p1=28,9;COORD p2=53,15;drawFrame(p1, p2, =

4、, |);SetPos(36,12);string str=“Game Over!“;for(int i=0; istr.size(); i+)Sleep(80);coutstri;Sleep(1000);system(“cls“);drawFrame(p1, p2, =, |);SetPos(31, 11);cout“击落敌机:“score/5“ 架“;SetPos(31, 12);cout“得 分:“score;SetPos(31, 13);cout“获得称号:“title;SetPos(30, 16);Sleep(1000);cout“继续? 是(y)| 否(n)“;as:char x=

5、_getch();if (x = n)exit(0);else if (x = y)system(“cls“);Game game;int a = drawMenu();if(a = 2)game.rank = 20;system(“cls“);drawPlaying();game.Playing();else goto as;/*= the main function =*/int main()/游戏准备srand(int)time(0); /随机种子HideCursor(); /隐藏光标Game game;int a = drawMenu();if(a = 2)game.rank = 20;system(“cls“);drawPlaying();game.Playing();

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 专业基础教材

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报