diff --git a/.idea/.idea.Motherload/.idea/workspace.xml b/.idea/.idea.Motherload/.idea/workspace.xml
index a1f6f60..b9d2954 100644
--- a/.idea/.idea.Motherload/.idea/workspace.xml
+++ b/.idea/.idea.Motherload/.idea/workspace.xml
@@ -13,15 +13,11 @@
-
-
-
-
-
-
+
+
@@ -40,6 +36,7 @@
+
@@ -191,7 +188,8 @@
-
+
+
@@ -257,7 +255,15 @@
1713354916684
-
+
+
+ 1713637256627
+
+
+
+ 1713637256627
+
+
@@ -274,7 +280,8 @@
-
+
+
diff --git a/Engine/utils.cpp b/Engine/utils.cpp
index ac3c593..ccb2680 100644
--- a/Engine/utils.cpp
+++ b/Engine/utils.cpp
@@ -232,15 +232,16 @@ void utils::FillPolygon(const std::vector& vertices) {
}
void utils::DrawArrow(const Vector2f& start, const Vector2f& end, float lineWidth, float arrowSize) {
// Origin is bottom left
+
utils::DrawLine(start, end);
- Vector2f arrowEnd = end - start;
- Vector2f dir = end - start;
+ const float arrowAngle = atan2f(end.y - start.y, end.x - start.x);
+ const float arrowAngle1 = arrowAngle + g_Pi + 0.4f;
+ const float arrowAngle2 = arrowAngle + g_Pi - 0.4f;
- utils::SetColor(Colors::RED);
- utils::DrawLine(end, end + Vector2f{ dir.y, -dir.x }.Normalized() * arrowSize);
- utils::DrawLine(end, end + Vector2f{ -dir.y, dir.x }.Normalized() * arrowSize);
-
-
+ const Vector2f arrow1 { end.x + arrowSize * cosf(arrowAngle1), end.y + arrowSize * sinf(arrowAngle1) };
+ const Vector2f arrow2 { end.x + arrowSize * cosf(arrowAngle2), end.y + arrowSize * sinf(arrowAngle2) };
+ utils::DrawLine(end, arrow1);
+ utils::DrawLine(end, arrow2);
}
void utils::FillPolygon(const Vector2f* pVertices, size_t nrVertices) {
diff --git a/Game/GridSystem/WorldTile.cpp b/Game/GridSystem/WorldTile.cpp
index 85c3513..1331879 100644
--- a/Game/GridSystem/WorldTile.cpp
+++ b/Game/GridSystem/WorldTile.cpp
@@ -104,6 +104,14 @@ void WorldTile::DrawSide(const TileDirection& direction) {
const WorldTile* tile = m_SurroundingTiles.GetTile(direction);
if(tile != nullptr) {
const GroundTileTypes type = tile->GetTileType()->getType();
+ if(direction == TileDirection::BottomMiddle || direction == TileDirection::BottomLeft || direction == TileDirection::BottomRight) {
+ if(type == Tiles::Special::GRASS->getType() || type == Tiles::Special::HARD_LEFT->getType() || type == Tiles::Special::HARD_MIDDLE->getType() || type == Tiles::Special::HARD_RIGHT->getType()) {
+ //Fix for edges being renderd on grass / hard tiles
+ //TODO: Possible fix if i have time
+ return;
+ }
+ }
+
if(type != Tiles::AIR->getType()) {
m_SideTextures[direction]->Draw(m_Position);
}
diff --git a/Game/GridSystem/WorldTile.h b/Game/GridSystem/WorldTile.h
index 56effde..0e9d11d 100644
--- a/Game/GridSystem/WorldTile.h
+++ b/Game/GridSystem/WorldTile.h
@@ -10,6 +10,7 @@ enum class GroundTileTypes
{
Air,
Dirt,
+ Grass,
Hard,
Stone,
Iron
@@ -97,7 +98,7 @@ namespace Tiles
static GroundTileType* HARD_RIGHT = new GroundTileType("tiles/dirt/special/hardRight.png", GroundTileTypes::Hard);
static GroundTileType* HARD_MIDDLE = new GroundTileType("tiles/dirt/special/hardMiddle.png", GroundTileTypes::Hard);
- static GroundTileType* GRASS = new RandomGroundTile("tiles/dirt/special/grass[0].png", GroundTileTypes::Dirt, 2);
+ static GroundTileType* GRASS = new RandomGroundTile("tiles/dirt/special/grass[0].png", GroundTileTypes::Grass, 2);
}
}
diff --git a/Game/Levels/World/WorldLevel.cpp b/Game/Levels/World/WorldLevel.cpp
index 7706d04..d109c26 100644
--- a/Game/Levels/World/WorldLevel.cpp
+++ b/Game/Levels/World/WorldLevel.cpp
@@ -45,12 +45,36 @@ WorldLevel::WorldLevel(Camera* camera, Rectf viewport): Level(camera),
}
for (int x { 0 }; x < WORLD_WIDTH; ++x) {
m_gridManager.GetTileAtIndex(x, 0)->SetTileType(Tiles::AIR);
- m_gridManager.GetTileAtIndex(x, 1)->SetTileType(Tiles::IRON);
+ m_gridManager.GetTileAtIndex(x, 1)->SetTileType(Tiles::Special::GRASS);
}
- m_refeulBuilding = new Building { "buildings/fuelStation.png", Vector2f { -700, -50 }, TextureManager::GetInstance() };
+ m_refeulBuilding = new Building { "buildings/fuelStation.png", Vector2f { -700, -52 }, TextureManager::GetInstance() };
m_gridManager.GetTileAtWorldPos(Vector2f { -700, -50 })->SetTileType(Tiles::Special::HARD_LEFT);
m_gridManager.GetTileAtWorldPos(Vector2f { -650, -50 })->SetTileType(Tiles::Special::HARD_MIDDLE);
m_gridManager.GetTileAtWorldPos(Vector2f { -600, -50 })->SetTileType(Tiles::Special::HARD_RIGHT);
+
+ m_mineralBuilding = new Building { "buildings/mineralStation.png", Vector2f { -350, -52 }, TextureManager::GetInstance() };
+ m_gridManager.GetTileAtWorldPos(Vector2f {-400, -50})->SetTileType(Tiles::Special::HARD_LEFT);
+ m_gridManager.GetTileAtWorldPos(Vector2f {-350, -50})->SetTileType(Tiles::Special::HARD_MIDDLE);
+ m_gridManager.GetTileAtWorldPos(Vector2f {-300, -50})->SetTileType(Tiles::Special::HARD_MIDDLE);
+ m_gridManager.GetTileAtWorldPos(Vector2f {-250, -50})->SetTileType(Tiles::Special::HARD_MIDDLE);
+ m_gridManager.GetTileAtWorldPos(Vector2f {-200, -50})->SetTileType(Tiles::Special::HARD_MIDDLE);
+ m_gridManager.GetTileAtWorldPos(Vector2f {-150, -50})->SetTileType(Tiles::Special::HARD_RIGHT);
+
+ m_junkBuilding = new Building { "buildings/junkStation.png", Vector2f { 250, -52 }, TextureManager::GetInstance() };
+ m_gridManager.GetTileAtWorldPos(Vector2f {200, -50})->SetTileType(Tiles::Special::HARD_LEFT);
+ m_gridManager.GetTileAtWorldPos(Vector2f {250, -50})->SetTileType(Tiles::Special::HARD_MIDDLE);
+ m_gridManager.GetTileAtWorldPos(Vector2f {300, -50})->SetTileType(Tiles::Special::HARD_MIDDLE);
+ m_gridManager.GetTileAtWorldPos(Vector2f {350, -50})->SetTileType(Tiles::Special::HARD_MIDDLE);
+ m_gridManager.GetTileAtWorldPos(Vector2f {400, -50})->SetTileType(Tiles::Special::HARD_MIDDLE);
+ m_gridManager.GetTileAtWorldPos(Vector2f {450, -50})->SetTileType(Tiles::Special::HARD_RIGHT);
+
+ m_repairBuilding = new Building { "buildings/repairStation.png", Vector2f { 700, -52 }, TextureManager::GetInstance() };
+ m_gridManager.GetTileAtWorldPos(Vector2f {650, -50})->SetTileType(Tiles::Special::HARD_LEFT);
+ m_gridManager.GetTileAtWorldPos(Vector2f {700, -50})->SetTileType(Tiles::Special::HARD_MIDDLE);
+ m_gridManager.GetTileAtWorldPos(Vector2f {750, -50})->SetTileType(Tiles::Special::HARD_MIDDLE);
+ m_gridManager.GetTileAtWorldPos(Vector2f {800, -50})->SetTileType(Tiles::Special::HARD_RIGHT);
+
+
}
WorldLevel::~WorldLevel() {
//delete m_pTextTexture;
@@ -137,6 +161,9 @@ void WorldLevel::Draw() const {
}
m_refeulBuilding->Draw();
+ m_mineralBuilding->Draw();
+ m_junkBuilding->Draw();
+ m_repairBuilding->Draw();
m_player.Draw();
utils::SetColor(Colors::GREEN);
diff --git a/Game/Levels/World/WorldLevel.h b/Game/Levels/World/WorldLevel.h
index 3fc09aa..b4928b7 100644
--- a/Game/Levels/World/WorldLevel.h
+++ b/Game/Levels/World/WorldLevel.h
@@ -40,6 +40,9 @@ private:
WorldTile* m_pSelectedTile { nullptr };
Building* m_refeulBuilding;
+ Building* m_mineralBuilding;
+ Building* m_junkBuilding;
+ Building* m_repairBuilding;
float testLerp{ 0.0f };
diff --git a/Resources/buildings/junkStation.png b/Resources/buildings/junkStation.png
new file mode 100644
index 0000000..d38dec5
Binary files /dev/null and b/Resources/buildings/junkStation.png differ
diff --git a/Resources/buildings/mineralStation.png b/Resources/buildings/mineralStation.png
new file mode 100644
index 0000000..3cdb85a
Binary files /dev/null and b/Resources/buildings/mineralStation.png differ
diff --git a/Resources/buildings/repairStation.png b/Resources/buildings/repairStation.png
new file mode 100644
index 0000000..0b0f511
Binary files /dev/null and b/Resources/buildings/repairStation.png differ
diff --git a/Resources/tiles/dirt/special/hardLeft.png b/Resources/tiles/dirt/special/hardLeft.png
index 1c2b59b..be2786c 100644
Binary files a/Resources/tiles/dirt/special/hardLeft.png and b/Resources/tiles/dirt/special/hardLeft.png differ