这篇文章主要为大家详细介绍了C语言实现飞机大战,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
本文实例为大家分享了C语言实现飞机大战的具体代码,供大家参考,具体内容如下

#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<Windows.h>
int score = 0;
int plane_col, plane_row;//·É»úλÖÃ
int bullet_col,bullet_row;//×Óµ¯µÄλÖÃ
int area_height, area_width;//ÓÎÏ·ÇøÓò 0-n-1
int enemy_col, enemy_row;
int enemy_vh, enemy_vv;
int a[100][100] = { 0 };
void gotoxy(int x, int y) {//Ë¢ÐÂ
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos;
pos.X = x;
pos.Y = y;
SetConsoleCursorPosition(handle, pos);
}
void HideCursor() {
CONSOLE_CURSOR_INFO cursor_info = { 1,0 };
SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &cursor_info);
}
void startup()//³õʼ»¯
{
area_height = 20;
area_width = 30;
plane_col = 14;
plane_row = 10;
bullet_col = 0;
bullet_row = -1;
enemy_col = rand() % area_width;
enemy_row = 0;
enemy_vh = 0;
enemy_vv = 1;
}
//int[][] planeArray() {
//
// a[plane_col][plane_row] = 1;
// for (int i = plane_col - 2; i < plane_col + 2; i++)
// a[i][plane_row + 1] = 1;
// a[plane_col - 1][plane_row + 2] = 1; a[plane_col + 1][plane_row + 2] = 1;
//
// return a;
/
织梦狗教程
本文标题为:C语言实现飞机大战
基础教程推荐
猜你喜欢
- [C语言]二叉搜索树 2023-09-07
- 全面了解C语言 static 关键字 2023-03-26
- C语言 详解字符串基础 2023-03-27
- 带你深度走入C语言取整以及4种函数 2022-09-17
- C++实现ETW进行进程变动监控详解 2023-05-15
- C语言编程C++旋转字符操作串示例详解 2022-11-20
- C语言实现宾馆管理系统课程设计 2023-03-13
- centos 7 vscode cmake 编译c++工程 2023-09-17
- [c语言-函数]不定量参数 2023-09-08
- C++实战之二进制数据处理与封装 2023-05-29
