贪吃蛇游戏开发

来源:百度知道 编辑:UC知道 时间:2024/06/24 05:55:16
我是学网络工程的,选到的毕设是软件开发,开发一个贪吃蛇的游戏,虽然现在有很多现成的,但是我需要自己开发!本人学过一些基本专业课程,例如:C,JAVA,JSP,VB,数据结构,汇编语言。
但是不知道该如何入手,请高人指教!

#include <windows.h>
#include <ctime>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
#ifndef SNAKE_H
#define SNAKE_H
class Cmp
{
friend class Csnake;
int rSign; //横坐标
int lSign; //竖坐标
public:
// friend bool isDead(const Cmp& cmp);
Cmp(int r,int l){setPoint(r,l);}
Cmp(){}
void setPoint(int r,int l){rSign=r;lSign=l;}
Cmp operator-(const Cmp &m)const
{
return Cmp(rSign-m.rSign,lSign-m.lSign);
}
Cmp operator+(const Cmp &m)const
{
return Cmp(rSign+m.rSign,lSign+m.lSign);
}
};

const int maxSize = 5; //初始蛇身长度
class Csnake
{
Cmp firstSign; //蛇头坐标
Cmp secondSign;//蛇颈坐标
Cmp lastSign; //蛇尾坐标
Cmp nextSign; //预备蛇头
int row; //列数
int line; //行数
int count; //蛇身长度
vector<vector<char> > snakeMap;//整个游戏界面