这篇文章主要为大家详细介绍了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-03-05
- C语言基础全局变量与局部变量教程详解 2022-12-31
- 一文带你了解C++中的字符替换方法 2023-07-20
- C++详细实现完整图书管理功能 2023-04-04
- C/C++编程中const的使用详解 2023-03-26
- 详解c# Emit技术 2023-03-25
- C语言 structural body结构体详解用法 2022-12-06
- C利用语言实现数据结构之队列 2022-11-22
- C++使用easyX库实现三星环绕效果流程详解 2023-06-26
- C++中的atoi 函数简介 2023-01-05