这篇文章主要为大家详细介绍了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++ const 成员函数,返回一个 const 指针.但是返回的指针是什么类型的 const? 2022-10-11
- C语言手把手带你掌握带头双向循环链表 2023-04-03
- C语言详解float类型在内存中的存储方式 2023-03-27
- Easyx实现扫雷游戏 2023-02-06
- 详解C语言中sizeof如何在自定义函数中正常工作 2023-04-09
- ubuntu下C/C++获取剩余内存 2023-09-18
- C++ 数据结构超详细讲解顺序表 2023-03-25
- Qt计时器使用方法详解 2023-05-30
- 我应该为我的项目使用相对包含路径,还是将包含目录放在包含路径上? 2022-10-30
- C语言qsort()函数的使用方法详解 2023-04-26