You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SeasonI/tiles.h

38 lines
1.0 KiB

#ifndef TILES_H
#define TILES_H
#include "pixelGameEngine.h"
#include "map.h"
using namespace olc;
extern std::map<std::string,Decal*> SPRITES;
class TILE{
public:
int tileX;
int tileY;
char tileDegree=0; //-1 is slanted from bottom-left to top-right. 1 is slanted from top-left to bottom-right.
TILE(int tileX,int tileY,char tileDegree)
:tileX(tileX),tileY(tileY),tileDegree(tileDegree){}
static char GetTileDegree(Map*map,int tileX,int tileY) {
if (map->tileset==SPRITES["terrainmap.png"]) {
if (tileX==12&&tileY==0||
tileX==12&&tileY==1) {
return -1;
}
if (tileX==14&&tileY==0||
tileX==14&&tileY==1) {
return 1;
}
}
return 0;
}
bool operator==(const TILE* rhs) {
return tileX==rhs->tileX&&
tileY==rhs->tileY&&
tileDegree==rhs->tileDegree;
}
bool operator!=(const TILE*t) {
return !(*this==t);
}
};
#endif