通过C语言编程一个小游戏(乐趣无边)
2301_77094874:
#include
#include
#include
#include
#include
#include
#define WIDTH 60
#define HEIGHT 20
enum direction
{
LEFT,RIGHT,UP,DOWN
};
struct structFood
{
int x;
int y;
};
struct structNode
{
int x;
int y;
struct structNode *pNext;
};
struct structSnake
{
int length;
enum direction dir;
};
struct structFood *pFood;
struct structSnake *pSnake;
struct structNode *pNode,*pTail;
int speech=250;
double score=0;
double lastscore=0;
char level='F';
double maxeat=0;
int smark=0;
int stop=0;
int counttime=0;
int countfood=0;
time_t start,end;
void hideCursor(void);
void gotoXY(int x,int y);
void initSnake(void);
void addNode(int x,int y);
void initFood(void);
void homePage(void);
void keybordHit(void);
void move(void);
void draw(void);
void eatFood(void);
void addTail(void);
void showresult(void);
void record(void);
void getlastscoreandlevel(void);
int main(void)
{
start =time(NULL);
|