📄 dragon.h
字号:
// DRAGON.h: interface for the DRAGON class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_DRAGON_H__9AFD0E69_461D_4A0D_BF4C_F37D704ED9D3__INCLUDED_)
#define AFX_DRAGON_H__9AFD0E69_461D_4A0D_BF4C_F37D704ED9D3__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
////////////////////////////////// 注:龙的身体是以单向双链表构造
////////////////////////////////// 目地是方便对每个节点的控制.
////////////////////////////////// 并设置头指针(*first),尾指针(*tail)
////////////////////////////////// 控制龙的移动
class DRAGON
{
/////////////公有变量//////////////
public:
BOOL IsDead; //是否死亡标志
int Direction; //方向标志,1=up,2=down,3=left,4=right
int Lenth; //龙体长
int Width; //龙体宽(龙单位的像素)
void Move(); //移动函数
DRAGON();
virtual ~DRAGON();
//////////////////////////////////
private:
/////////////////龙的单位体//////////////
class DRAGONNODE
{
public:
DRAGONNODE();
int x; //单位体X坐标
int y; //单位体y坐标
DRAGONNODE *llink,*rlink;
};
////////////////////////////////////////
public:
void Init(); //初始化
void Eat(); //
BOOL IsBody(int x,int y);
void DgnMove();
int GetY(int nflag);
int GetX(int nflag);
void RightMove();
void LeftMove();
void DownMove();
void UpMove();
DRAGONNODE *first,*tail;
};
#endif // !defined(AFX_DRAGON_H__9AFD0E69_461D_4A0D_BF4C_F37D704ED9D3__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -