資源簡介
c++ 貪吃蛇 A0.1 示例源碼
代碼片段和文件信息
#include?
#include?
#include?
#include?
#include?
using?namespace?std;
int?food[2]?=?{?9?9?};
int?snake[1000][2];
int?length?=?1;
int?headX?headY;
int?speed?=?500;
int?score?=?0;
int?level?=?1;
string?name;
void?gotoxy(short?x?short?y);
int?setdirection(int?x);
void?changesnake(int?x);
void?ifchangefood();
void?makefood();
bool?judgelife();
void?drawsnake();
void?drawfood();
void?drawwall();
void?drawscore();
void?draw();
int?main()
{
????SetConsoletitle(“貪吃蛇游戲“);
????int?po?=?2;
????snake[0][0]?=?7;
????snake[0][1]?=?7;
????headX?=?snake[0][0];
????headY?=?snake[0][1];
????gotoxy(30?7);
????cout?<“歡迎來到貪吃蛇游戲“;
????gotoxy(30?9);
????cout?<“作者:陳偉豪?版本0.1“;
????gotoxy(30?11);
????system(“cls“);
- 上一篇:C語言推箱子 游戲源碼
- 下一篇:c++ 雙人彈球 小游戲
評論
共有 條評論