Add fly animations
This commit is contained in:
@@ -36,20 +36,20 @@ GroundTileType * getRandomGroundTile() {
|
||||
}
|
||||
void InitializeGroundTiles() {
|
||||
Tiles tiles {};
|
||||
GroundTileTypeManager::GetInstance()->AIR = new GroundTileType("", GroundTileTypes::Air);
|
||||
GroundTileTypeManager::GetInstance()->DIRT = new RandomGroundTile("tiles/dirt/dirt[0].png", GroundTileTypes::Dirt, 5);
|
||||
GroundTileTypeManager::GetInstance()->AIR = new GroundTileType("", GroundTileTypes::Air, 0);
|
||||
GroundTileTypeManager::GetInstance()->DIRT = new RandomGroundTile("tiles/dirt/dirt[0].png", GroundTileTypes::Dirt, 5, 250);
|
||||
|
||||
GroundTileTypeManager::GetInstance()->STONE = new RandomGroundTile("tiles/ores/Ore_Stone_[0].png", GroundTileTypes::Stone, 3);
|
||||
GroundTileTypeManager::GetInstance()->LAVA = new RandomGroundTile("tiles/ores/Ore_Lava_[0].png", GroundTileTypes::Lava, 3);
|
||||
GroundTileTypeManager::GetInstance()->STONE = new RandomGroundTile("tiles/ores/Ore_Stone_[0].png", GroundTileTypes::Stone, 3, 0);
|
||||
GroundTileTypeManager::GetInstance()->LAVA = new RandomGroundTile("tiles/ores/Ore_Lava_[0].png", GroundTileTypes::Lava, 3, 0);
|
||||
|
||||
GroundTileTypeManager::GetInstance()->IRON = new GroundTileType("tiles/ores/Ore_Ironium.png", GroundTileTypes::Iron);
|
||||
GroundTileTypeManager::GetInstance()->BRONZE = new GroundTileType("tiles/ores/Ore_Bronzium.png", GroundTileTypes::Bronze);
|
||||
GroundTileTypeManager::GetInstance()->GOLD = new GroundTileType("tiles/ores/Ore_Goldium.png", GroundTileTypes::Gold);
|
||||
GroundTileTypeManager::GetInstance()->IRON = new GroundTileType("tiles/ores/Ore_Ironium.png", GroundTileTypes::Iron, 1500);
|
||||
GroundTileTypeManager::GetInstance()->BRONZE = new GroundTileType("tiles/ores/Ore_Bronzium.png", GroundTileTypes::Bronze, 3000);
|
||||
GroundTileTypeManager::GetInstance()->GOLD = new GroundTileType("tiles/ores/Ore_Goldium.png", GroundTileTypes::Gold, 12500);
|
||||
|
||||
GroundTileTypeManager::GetInstance()->GRASS = new RandomGroundTile("tiles/dirt/special/grass[0].png", GroundTileTypes::Grass, 2);
|
||||
GroundTileTypeManager::GetInstance()->HARD_LEFT = new GroundTileType("tiles/dirt/special/hardLeft.png", GroundTileTypes::Hard);
|
||||
GroundTileTypeManager::GetInstance()->HARD_RIGHT = new GroundTileType("tiles/dirt/special/hardRight.png", GroundTileTypes::Hard);
|
||||
GroundTileTypeManager::GetInstance()->HARD_MIDDLE = new GroundTileType("tiles/dirt/special/hardMiddle.png", GroundTileTypes::Hard);
|
||||
GroundTileTypeManager::GetInstance()->GRASS = new RandomGroundTile("tiles/dirt/special/grass[0].png", GroundTileTypes::Grass, 2, 250);
|
||||
GroundTileTypeManager::GetInstance()->HARD_LEFT = new GroundTileType("tiles/dirt/special/hardLeft.png", GroundTileTypes::Hard, 0);
|
||||
GroundTileTypeManager::GetInstance()->HARD_RIGHT = new GroundTileType("tiles/dirt/special/hardRight.png", GroundTileTypes::Hard, 0);
|
||||
GroundTileTypeManager::GetInstance()->HARD_MIDDLE = new GroundTileType("tiles/dirt/special/hardMiddle.png", GroundTileTypes::Hard, 0);
|
||||
|
||||
GroundTileWeights = {
|
||||
{ GroundTileTypeManager::GetInstance()->AIR, 0.2f },
|
||||
@@ -70,7 +70,7 @@ WorldTile::WorldTile(const Vector2f& position, GroundTileType* groundTileType, T
|
||||
m_GroundTileType { groundTileType }, m_pGridManager { pGridManager } {
|
||||
// const std::string dirtPath = + "tiles/dirt/dirt" + std::to_string(utils::randRange(1, 5)) + ".png";
|
||||
// m_pTexture = new Texture(dirtPath);
|
||||
m_pTexture = pTextureManager->GetTexture(groundTileType->getPath());
|
||||
m_pTexture = pTextureManager->GetTexture(groundTileType->GetPath());
|
||||
|
||||
m_SideTextures[TileDirection::TopLeft] = pTextureManager->GetTexture("tiles/dirt/sidepieces/topLeft.png");
|
||||
m_SideTextures[TileDirection::TopRight] = pTextureManager->GetTexture("tiles/dirt/sidepieces/topRight.png");
|
||||
@@ -90,7 +90,7 @@ WorldTile::~WorldTile() {
|
||||
void WorldTile::Draw() {
|
||||
|
||||
|
||||
switch (m_GroundTileType->getType()) {
|
||||
switch (m_GroundTileType->GetType()) {
|
||||
case GroundTileTypes::Air: {
|
||||
//check if it's all around dirt
|
||||
// bool allDirt = true;
|
||||
@@ -157,17 +157,17 @@ Collision::TileCollisionRect WorldTile::GetCollisionRect() {
|
||||
void WorldTile::DrawSide(const TileDirection& direction) {
|
||||
const WorldTile* tile = m_SurroundingTiles.GetTile(direction);
|
||||
if (tile != nullptr) {
|
||||
const GroundTileTypes type = tile->GetTileType()->getType();
|
||||
const GroundTileTypes type = tile->GetTileType()->GetType();
|
||||
if (direction == TileDirection::BottomMiddle || direction == TileDirection::BottomLeft || direction == TileDirection::BottomRight) {
|
||||
if (type == GroundTileTypeManager::GetInstance()->GRASS->getType() || type == GroundTileTypeManager::GetInstance()->HARD_LEFT->getType() || type ==
|
||||
GroundTileTypeManager::GetInstance()->HARD_MIDDLE->getType() || type == GroundTileTypeManager::GetInstance()->HARD_RIGHT->getType()) {
|
||||
if (type == GroundTileTypeManager::GetInstance()->GRASS->GetType() || type == GroundTileTypeManager::GetInstance()->HARD_LEFT->GetType() || type ==
|
||||
GroundTileTypeManager::GetInstance()->HARD_MIDDLE->GetType() || type == GroundTileTypeManager::GetInstance()->HARD_RIGHT->GetType()) {
|
||||
//Fix for edges being renderd on grass / hard tiles
|
||||
//TODO: Possible fix if i have time
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (type != GroundTileTypeManager::GetInstance()->AIR->getType()) {
|
||||
if (type != GroundTileTypeManager::GetInstance()->AIR->GetType()) {
|
||||
m_SideTextures[direction]->Draw(m_Position);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user