-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMap.h
59 lines (53 loc) · 1.27 KB
/
Map.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
#pragma once
#include <SFML\Graphics.hpp>
//#include <iostream>
#include <fstream>
#include <vector>
#include "Tile.h"
#include "Constants.h"
#include "Player.h"
struct CollisionTile
{
sf::Vector2f tilePosition;
TILE_TYPE tileType;
};
struct MapTiles
{
char currentTile;
MapTiles *nextTile;
};
class Map
{
public:
Map();
~Map();
void DrawLevel(sf::RenderWindow &gvnWindow);
void LoadNewMap();
void ChangeMap(unsigned int gvnMapNumber);
void CheckPlayerWithTileCollision( Player &gvnPlayer);
void SetObstacles();
void SpawnItems();
void SpawnEnemies();
void CountScore();
bool ReturnErrorState();
private:
bool newMapIsLoaded;
const int tileWidth = 32;
const int tileHeight = 32;
const int numberOfTiles = 5;
//const int mapWidth = 640 / tileHeight;
//const int mapHeight = 480 / tileHeight;
std::vector<Tile> tileSet;
std::vector<CollisionTile> collisionTilePos;
sf::Texture tileTextureSet;
bool criticalError;
MapTiles *mapTileContent;
MapTiles *lastMapTileContent;
std::string mapLocalization;
private:
void InsertTilesIntoVector();
sf::Sprite GetTile(TILE_TYPE gvnTileType);
MapTiles *PushBackTile(char c);
TILE_TYPE FileCheckTileType(char c);
//void SetCollisionTilePos(char c, sf::Vector2f);
};