fix tile position ingame

This commit is contained in:
arthur.jamet
2021-06-17 12:25:35 +02:00
parent 9c1f0b1bcd
commit f0b6b59428
+2 -4
View File
@@ -205,10 +205,8 @@ namespace BBM
int mapWidth = 16;
int mapHeight = 16;
int playerCount = 0;
int playerID = 0;
for (auto &[_, lobby] : wal.getScene()->view<LobbyComponent>()) {
playerID++;
if (lobby.layout == ControllableComponent::NONE)
continue;
auto &player = Runner::createPlayer(*scene);
@@ -219,8 +217,8 @@ namespace BBM
auto *model = dynamic_cast<RAY3D::Model *>(player.getComponent<Drawable3DComponent>().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<PositionComponent>(x, y - 2, 0)
.addComponent<Drawable2DComponent, RAY2D::Rectangle>(x, y, 320, 248, _rayColors[lobby.color]);