-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlevel.hpp
42 lines (38 loc) · 2.05 KB
/
level.hpp
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
#pragma once
//======================================================================================
//Header for game level = grid environment
//
//(c) Patrick Dickinson, University of Lincoln, School of Computer Science, 2020
//======================================================================================
#include "game.hpp"
//======================================================================================
//Level class
//======================================================================================
class cLevel
{
//======================================================================================
//Grid is just a 2D array. Note that array is indexed [row][Column]
//======================================================================================
int map[GRIDWIDTH][GRIDHEIGHT];
public:
cLevel();
//======================================================================================
//Loads an ascii text file describing layout
//======================================================================================
void Load(const char* fname);
//======================================================================================
//Draw entire grid in 640x640 window
//======================================================================================
// in order to opt for a function in main.cpp (Manhattan, Euclidean, Diagonal), we proceed to add an argument to the draw function
void Draw(int select_function);
//======================================================================================
//Return whether a specified grid location is blocked/valid
//valid = not blocked and in range 0 to 39
//======================================================================================
bool isBlocked(int x, int y) const { return(map[x][y] != 0); }
bool isValid(int x, int y) const;
};
//======================================================================================
//Global level object
//======================================================================================
extern cLevel gLevel;