From f0b6b594284be815951be31568f4047038d1b4f9 Mon Sep 17 00:00:00 2001 From: "arthur.jamet" Date: Thu, 17 Jun 2021 12:25:35 +0200 Subject: [PATCH] fix tile position ingame --- sources/System/Lobby/LobbySystem.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sources/System/Lobby/LobbySystem.cpp b/sources/System/Lobby/LobbySystem.cpp index 4d2fd563..bee21b8b 100644 --- a/sources/System/Lobby/LobbySystem.cpp +++ b/sources/System/Lobby/LobbySystem.cpp @@ -205,10 +205,8 @@ namespace BBM int mapWidth = 16; int mapHeight = 16; int playerCount = 0; - int playerID = 0; for (auto &[_, lobby] : wal.getScene()->view()) { - playerID++; if (lobby.layout == ControllableComponent::NONE) continue; auto &player = Runner::createPlayer(*scene); @@ -219,8 +217,8 @@ namespace BBM auto *model = dynamic_cast(player.getComponent().drawable.get()); model->setTextureToMaterial(MAP_DIFFUSE, "assets/player/textures/" + _colors[lobby.color] + ".png"); std::string texturePath = "assets/player/ui/" + _colors[lobby.color] + ".png"; - int x = (playerID % 2 == 0) ? 1920 - 10 - 320 : 10; - int y = playerID > 2 ? 1080 - 10 - 248 : 10; + int x = (playerCount % 2 == 0) ? 1920 - 10 - 320 : 10; + int y = (playerCount % 3 != 0) ? 1080 - 10 - 248 : 10; scene->addEntity("player color tile") .addComponent(x, y - 2, 0) .addComponent(x, y, 320, 248, _rayColors[lobby.color]);