資源簡介
簡單的控制臺游戲
代碼片段和文件信息
#include?
#include?
#include?
#include?
void?HideCursor();
void?gotoxy(int?x?int?y);
void?DrawPicture();
void?UpdataWithInput();
void?UpdataWithoutInput();
void?StartGame();
//?全局變量
const?int?num?=?5;??//?子彈數
const?int?difficulty?=?3;??//?游戲難度??0-5
int?position_x?position_y;??//?飛機位置
int?enemy_x?enemy_y;??//?敵機位置
int?high?width;??//?游戲畫面尺寸
int?score;??//?得分
int?currentBullet;??//?當前子彈數??
bool?isFire;??//?是否開火
int?sleep;
struct?Bullet?{????//??保存子彈坐標
int?x;
int?y;
};
struct?Bullet?bullet[num];
int?main()
{
StartGame();
while?(1)
{
DrawPicture();
UpdataWithInput();
UpdataWithoutInput();
}
return?0;
}
void?StartGame()
{
HideCursor();
//system(“color?6“);
isFire?=?false;
score?=?0;
評論
共有 條評論