-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSnake_second.h
More file actions
58 lines (40 loc) · 1.04 KB
/
Snake_second.h
File metadata and controls
58 lines (40 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef SNAKE_SECOND_H //玩家二
#define SNAKE_SECOND_H
#include"Food.h"
class Snake_second
{
public:
Snake_second(Wall& wall, Food& food); //构造函数
enum //枚举类型代表玩家二上下左右的方向
{
UP = 'i',
DOWN = 'k',
LEFT = 'j',
RIGHT = 'l',
};
struct point //结构体,储存节点
{
int x;
int y;
point* next;
};
void InitSnake(); //初始化蛇
bool Move(char key); //移动蛇
void DestoryPoint(); //销毁所有节点
void AddPoint(int, int); //增加节点
void DeletePoint(); //删除节点
int Countlist(); //计算蛇身长度
int Getscore(); //获取得分
void Resetscore(); //重置得分
int Getability(); //查看是否具有穿墙能力
void Resetability(); //重置穿墙能力
clock_t start; //记录时间
private:
int score ; //得分
int ability; //表示蛇是否具有穿墙能力
point* Head;
Wall& wall_;
Food& food_;
};
#endif // !SNAKE_H
#pragma once