-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtileMap.h
50 lines (39 loc) · 1.13 KB
/
tileMap.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
#pragma once
#define COIN 2
#define COIN_SOUND "assets/sound/coin.wav"
#define WIN_SOUND "assets/sound/win.wav"
#include<SFML/Graphics.hpp>
#include<SFML/Window.hpp>
#include"Entity.h"
#include"GameInfo.h"
#include<fstream>
#include<iostream>
#include<stdio.h>
#include<vector>
#define BOTTOM 0
#define TOP 1
#define LEFT 2
#define RIGHT 3
class TileMap : public sf::Drawable, public sf::Transformable
{
std::vector<int> tiles;
sf::VertexArray m_vertices;
sf::Texture m_tileset;
sf::Vector2u tileSize;
unsigned int width;
unsigned int height;
unsigned int mapWidth;
void draw(sf::RenderTarget& target, sf::RenderStates states) const;
bool bonus;
SoundBuffer coinBuffer, winBuffer;
Sound coinSound, winSound;
public:
TileMap();
bool load(const std::string& tileset, sf::Vector2u tileSize);
int collision(Entity& Entity, GameInfo& gameInfo); // function returns from what side collision comes from and move object to the opposit side
float min4(float tab[]);
void loadArrayFromArray(std::string fileName);
int getMapWidth() { return mapWidth; }
bool getBonus() { return bonus; }
void setBonus(bool bonus) { this->bonus = bonus; }
};