-
Notifications
You must be signed in to change notification settings - Fork 0
/
Board.h
101 lines (94 loc) · 1.9 KB
/
Board.h
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
* Board.h
*
* Created on: May 2, 2014
* Author: Sibt ul Hussain
*/
#ifndef _BOARD_H_
#define _BOARD_H_
#include <GL/glut.h>
#include <iostream>
#include<fstream>
#include "util.h"
#include"Flea.h"
#include"ScoreBoard.h"
#include"GameObject.h"
#include"MoveableObject.h"
#include"Bomb.h"
#include"Player.h"
#include"Mushroom.h"
#include"Segment.h"
#include"LazySeg.h"
#include"Centipede.h"
//#define WITH_TEXTURES
using namespace std;
class Board {
private:
// bool highest=false;
int highs[20]={0};
int xcellsize, ycellsize;
int width, height;
ColorNames pcolor, bcolor, gcolor;
bool make=true;
bool endGame;
bool youWin=false;
public:
bool menu;
int menuNo;
vector<GameObject*>gameObj;
Player *p=new Player;
Flea *fle=new Flea;
int s=fle->getSize();
int *arr=fle->getTrail();
ScoreBoard* scoreBoard=new ScoreBoard;
Centipede snake;
static const int BOARD_X = 51;
static const int BOARD_Y = 40;
/*
static const int BOARD_X=17;
static const int BOARD_Y=14;
*/
void win();
bool centipedeEatPlayer();
bool collisionWithFlea(int i);
bool collisionWithMushroom(int i);
bool collisionWithCentipede(int i);
bool changeDirectionCentipede(int i);
void InitializePolyArray();
void gameOver();
void drawMenu();
int board_array[BOARD_Y][BOARD_X];
Board(int xsize = 8, int ysize = 8);
~Board(void);
void InitalizeBoard(int, int);
//draw the board
void Draw();
static int GetBoardX() {
return BOARD_X;
}
static int GetBoardY() {
return BOARD_Y;
}
int GetMidX() {
return BOARD_X * xcellsize / 2.0;
}
int GetMidY() {
return BOARD_Y * ycellsize / 2.0;
}
int GetCellSize() {
return xcellsize;
}
void GetInitRandomPosition(int &x, int &y) {
// leave 10 units from all sides
x = GetRandInRange(50, width - 50);
y = GetRandInRange(50, height - 50);
}
int GetWidth() {
return width;
}
int GetHeight() {
return height;
}
void GetInitTextPosition(int &x, int &y);
};
#endif