diff --git a/CMakeLists.txt b/CMakeLists.txt index 73293abe..5cc80c6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,6 +113,14 @@ set(SOURCES sources/System/Lobby/LobbySystem.hpp sources/Component/Lobby/LobbyComponent.cpp sources/Component/Lobby/LobbyComponent.hpp + sources/Component/Gravity/GravityComponent.hpp + sources/Component/Gravity/GravityComponent.cpp + sources/System/Gravity/GravitySystem.hpp + sources/System/Gravity/GravitySystem.cpp + sources/Component/BumperTimer/BumperTimerComponent.hpp + sources/Component/BumperTimer/BumperTimerComponent.cpp + sources/System/BumperTimer/BumperTimerSystem.hpp + sources/System/BumperTimer/BumperTimerSystem.cpp sources/System/Bomb/BombSystem.cpp sources/System/Bomb/BombSystem.hpp sources/Component/IntroAnimation/IntroAnimationComponent.hpp @@ -126,7 +134,8 @@ set(SOURCES sources/Runner/PauseMenuScene.cpp sources/Runner/SettingsMenuScene.cpp sources/Runner/CreditScene.cpp - sources/Runner/LobbyScene.cpp) + sources/Runner/LobbyScene.cpp +) add_executable(bomberman sources/main.cpp ${SOURCES} diff --git a/sources/Component/BumperTimer/BumperTimerComponent.cpp b/sources/Component/BumperTimer/BumperTimerComponent.cpp new file mode 100644 index 00000000..1d661395 --- /dev/null +++ b/sources/Component/BumperTimer/BumperTimerComponent.cpp @@ -0,0 +1,17 @@ +// +// Created by Tom Augier on 2021-05-20. +// + +#include "BumperTimerComponent.hpp" + +namespace BBM +{ + BumperTimerComponent::BumperTimerComponent(WAL::Entity &entity) + : WAL::Component(entity) + {} + + WAL::Component *BumperTimerComponent::clone(WAL::Entity &entity) const + { + return new BumperTimerComponent(entity); + } +} \ No newline at end of file diff --git a/sources/Component/BumperTimer/BumperTimerComponent.hpp b/sources/Component/BumperTimer/BumperTimerComponent.hpp new file mode 100644 index 00000000..a0b8c958 --- /dev/null +++ b/sources/Component/BumperTimer/BumperTimerComponent.hpp @@ -0,0 +1,41 @@ +// +// Created by Tom Augier on 2021-05-20. +// + +#pragma once + +#include +#include "Component/Component.hpp" +#include "Entity/Entity.hpp" + +using namespace std::chrono_literals; + +namespace BBM +{ + class BumperTimerComponent : public WAL::Component + { + public: + + + bool _isReseting = false; + //! @brief The number of seconds of each rest. This variable is used to reset the nextReset value. + std::chrono::nanoseconds resetRate = 1500ms; + //! @brief The number of nanosecond before the next bumper reset for the player. + std::chrono::nanoseconds nextReset = resetRate; + + //! @inherit + WAL::Component *clone(WAL::Entity &entity) const override; + + //! @brief Constructor + BumperTimerComponent(WAL::Entity &entity); + + //! @brief A BumperTimer component can't be instantiated, it should be derived. + BumperTimerComponent(const BumperTimerComponent &) = default; + + //! @brief default destructor + ~BumperTimerComponent() override = default; + + //! @brief A BumperTimer component can't be assigned + BumperTimerComponent &operator=(const BumperTimerComponent &) = delete; + }; +} \ No newline at end of file diff --git a/sources/Component/Gravity/GravityComponent.cpp b/sources/Component/Gravity/GravityComponent.cpp new file mode 100644 index 00000000..a6ee1db4 --- /dev/null +++ b/sources/Component/Gravity/GravityComponent.cpp @@ -0,0 +1,17 @@ +// +// Created by Tom Augier on 2021-05-20. +// + +#include "GravityComponent.hpp" + +namespace BBM +{ + GravityComponent::GravityComponent(WAL::Entity &entity) + : WAL::Component(entity) + {} + + WAL::Component *GravityComponent::clone(WAL::Entity &entity) const + { + return new GravityComponent(entity); + } +} \ No newline at end of file diff --git a/sources/Component/Gravity/GravityComponent.hpp b/sources/Component/Gravity/GravityComponent.hpp new file mode 100644 index 00000000..59f7cc89 --- /dev/null +++ b/sources/Component/Gravity/GravityComponent.hpp @@ -0,0 +1,31 @@ +// +// Created by Tom Augier on 2021-05-20. +// + +#pragma once + +#include "Component/Component.hpp" +#include "Entity/Entity.hpp" + +namespace BBM +{ + class GravityComponent : public WAL::Component + { + public: + + //! @inherit + WAL::Component *clone(WAL::Entity &entity) const override; + + //! @brief Constructor + GravityComponent(WAL::Entity &entity); + + //! @brief A Gravity component can't be instantiated, it should be derived. + GravityComponent(const GravityComponent &) = default; + + //! @brief default destructor + ~GravityComponent() override = default; + + //! @brief A Gravity component can't be assigned + GravityComponent &operator=(const GravityComponent &) = delete; + }; +} \ No newline at end of file diff --git a/sources/Map/Map.cpp b/sources/Map/Map.cpp index 323fadb1..ed646dd2 100644 --- a/sources/Map/Map.cpp +++ b/sources/Map/Map.cpp @@ -9,15 +9,41 @@ #include #include #include -#include "Component/Movable/MovableComponent.hpp" #include #include +#include namespace RAY3D = RAY::Drawables::Drawables3D; using namespace std::chrono_literals; namespace BBM { + void MapGenerator::bumperCollide(WAL::Entity &entity, + const WAL::Entity &wall, + CollisionComponent::CollidedAxis collidedAxis) + { + auto *movable = entity.tryGetComponent(); + auto *bumperTimer = entity.tryGetComponent(); + + if (!movable || !bumperTimer) + return; + if (!bumperTimer->_isReseting) { + movable->_velocity.y = 1.5; + bumperTimer->_isReseting = true; + } + } + + void MapGenerator::holeCollide(WAL::Entity &entity, + const WAL::Entity &wall, + CollisionComponent::CollidedAxis collidedAxis) + { + auto *health = entity.tryGetComponent(); + + if (!health) + return; + health->takeDmg(health->getHealthPoint()); + } + void MapGenerator::wallCollided(WAL::Entity &entity, const WAL::Entity &wall, CollisionComponent::CollidedAxis collidedAxis) @@ -168,7 +194,7 @@ namespace BBM for (int i = 0; i < width + 1; i++) { for (int j = 0; j < height + 1; j++) { if (map[std::make_tuple(i, 0, j)] != HOLE && map[std::make_tuple(i, -1, j)] != BUMPER) - scene->addEntity("Floor") + scene->addEntity("Ground") .addComponent(Vector3f(i, -1, j)) .addComponent(floorObj, false, std::make_pair(MAP_DIFFUSE, floorPng)); @@ -254,19 +280,16 @@ namespace BBM WAL::Entity &holeEntity = scene->addEntity("Hole Block"); - holeEntity.addComponent(Vector3f(coords.x, coords.y - 1, coords.z)); - + holeEntity.addComponent(Vector3f(coords.x, coords.y - 1, coords.z)) + .addComponent( + WAL::Callback(), + &MapGenerator::holeCollide, Vector3f(0.25, 0.25, 0.25),Vector3f(0.75, 1.75, 0.75)); if (coords.y == 0) holeEntity.addComponent(holeObj, false, std::make_pair(MAP_DIFFUSE, holePng)); else holeEntity.addComponent(secondFloorObj, false, std::make_pair(MAP_DIFFUSE, secondFloorPng)); - /*.addComponent([](WAL::Entity &other, const WAL::Entity &entity) { - if (other.hasComponent()) { - auto &health = other.getComponent(); - health.takeDmg(health.getHealthPoint()); - } - }, [](WAL::Entity &other, const WAL::Entity &entity){}); */ + } void MapGenerator::createBumper(Vector3f coords, std::shared_ptr scene) @@ -276,13 +299,10 @@ namespace BBM scene->addEntity("Bumper Block") .addComponent(Vector3f(coords.x, coords.y, coords.z)) - .addComponent(bumperObj, false, std::make_pair(MAP_DIFFUSE, bumperPng)); - /* .addComponent([](const WAL::Entity &entity, WAL::Entity &other) { - if (other.hasComponent()) { - auto &movable = other.getComponent(); - movable.addForce(Vector3f(0, 5, 0)); - } - }); */ + .addComponent(bumperObj, false,std::make_pair(MAP_DIFFUSE, bumperPng)) + .addComponent( + WAL::Callback(), + &MapGenerator::bumperCollide, Vector3f(0.25, 0.25, 0.25),Vector3f(0.75, 0.75, 0.75)); } bool MapGenerator::isCloseToBlockType(std::map, BlockType> map, int x, int y, int z, @@ -298,7 +318,7 @@ namespace BBM { double rnd = static_cast(std::rand()) / RAND_MAX; - if (rnd > 0.95) + if (rnd > 0.98) return HOLE; if (rnd > 0.25) return BREAKABLE; @@ -309,7 +329,7 @@ namespace BBM { double rnd = static_cast(std::rand()) / RAND_MAX; - if (rnd > 0.60) { + if (rnd > 0.01) { for (int i = 0; i < width + 1; i++) { map[std::make_tuple(i, 1, height)] = map[std::make_tuple(i, 0, height)]; map[std::make_tuple(i, 0, height)] = UPPERFLOOR; @@ -322,12 +342,10 @@ namespace BBM map[std::make_tuple(width, -1, 1)] = BUMPER; map[std::make_tuple(width / 2, -1, height - 1)] = BUMPER; map[std::make_tuple(width / 2, -1, 1)] = BUMPER; - } - if (rnd > 0.30) { + } + if (rnd > 0.01) { for (int i = width / 2 - width / 4; i < width / 2 + width / 4 + 1; i++) { for (int j = height / 2 - height / 4; j < height / 2 + height / 4 + 1; j++) { - if (map[std::make_tuple(i, 0, j)] == FLOOR) - continue; map[std::make_tuple(i, 1, j)] = map[std::make_tuple(i, 0, j)]; map[std::make_tuple(i, 0, j)] = UPPERFLOOR; } @@ -356,26 +374,60 @@ namespace BBM for (int j = 0; j < height; j++) { if (map[std::make_tuple(i, 0, j)] == BREAKABLE && map[std::make_tuple(i, -1, j)] == BUMPER) map[std::make_tuple(i, 0, j)] = NOTHING; + if (map[std::make_tuple(i, 1, j)] == BREAKABLE && isCloseToBlockType(map, i, -1, j, BUMPER)) + map[std::make_tuple(i, 1, j)] = NOTHING; } return (map); } - MapGenerator::MapBlock MapGenerator::createMap(int width, int height) + MapGenerator::MapBlock MapGenerator::createClassicUnbreakable(MapBlock map, int width, int height) + { + for (int i = 0; i < width + 1; i++) { + for (int j = 0; j < height + 1; j++) { + if (!((i + 1) % 2) && !((j + 1) % 2)) + map[std::make_tuple(i, 0, j)] = UNBREAKABLE; + } + } + return (map); + } + + MapGenerator::MapBlock MapGenerator::createLongClassicUnbreakable(MapBlock map, int width, int height) + { + int placedSpace = 0; + + for (int i = 1; i < width; i++) { + placedSpace = 0; + for (int j = 1; j < height; j++) { + if (!(j % 2)) + continue; + if (i < (width / 2 - width / 10) || i > (width / 2 + width / 10)) + map[std::make_tuple(i, 0, j)] = UNBREAKABLE; + else + placedSpace++; + } + } + return (map); + } + + + MapGenerator::MapBlock MapGenerator::createMap(int width, int height, bool isHeight, bool isNotClassic) { MapBlock map; width = width % 2 ? width + 1 : width; height = height % 2 ? height + 1 : height; - for (int i = 0; i < width; i++) - for (int j = 0; j < height; j++) + for (int i = 0; i < width + 1; i++) + for (int j = 0; j < height + 1; j++) { map[std::make_tuple(i, 0, j)] = NOTHING; + map[std::make_tuple(i, 1, j)] = NOTHING; + } map = createSpawner(map, width, height); for (int i = 0; i < width + 1; i++) { for (int j = 0; j < height + 1; j++) { if (map[std::make_tuple(i, 0, j)] == SPAWNER) continue; if (isCloseToBlockType(map, i, 0, j, SPAWNER)) { - map[std::make_tuple(i, 0, j)] = NOTHING; + map[std::make_tuple(i, isNotClassic ? -1 : 0, j)] = isNotClassic ? BUMPER : NOTHING; } else { map[std::make_tuple(i, 0, j)] = getRandomBlockType(); } @@ -383,17 +435,59 @@ namespace BBM map[std::make_tuple(i, 0, j)] = BREAKABLE; } } - for (int i = 0; i < width + 1; i++) - for (int j = 0; j < height + 1; j++) - if (!((i + 1) % 2) && !((j + 1) % 2)) - map[std::make_tuple(i, 0, j)] = UNBREAKABLE; - map = createHeight(map, width, height); + if (!isNotClassic) + map = createClassicUnbreakable(map, width, height); + else + map = createLongClassicUnbreakable(map, width, height); + if (isHeight) + map = createHeight(map, width, height); map = cleanBreakable(map, width, height); return (map); } + void MapGenerator::generateHeightCollision(MapBlock map, int width, int height, std::shared_ptr scene) + { + int floor = 2; + + for (int i = 0; i < width + 1; i++) { + if (map[std::make_tuple(i, 0, height)] == NOTHING && map[std::make_tuple(i, 0, 0)] == NOTHING) { + floor -= 1; + break; + } + } + for (int i = width / 2 - width / 4; i < width / 2 + width / 4 + 1; i++) { + for (int j = height / 2 - height / 4; j < height / 2 + height / 4 + 1; j++) { + if (map[std::make_tuple(i, 0, i)] == NOTHING) { + floor -= 1; + break; + } + } + if (floor <= 0) + break; + } + if (floor >= 1) { + scene->addEntity("FloorBot Hitbox") + .addComponent(Vector3f(0, 0, 0)) + .addComponent( + WAL::Callback(), + &MapGenerator::wallCollided, Vector3f(0.25, 0.25, 0.25), Vector3f(width, 0.75, 0.75)); + scene->addEntity("FloorUp Hitbox") + .addComponent(Vector3f(0, 0, height)) + .addComponent( + WAL::Callback(), + &MapGenerator::wallCollided, Vector3f(0.25, 0.25, 0.25),Vector3f(width, 0.75, 0.75)); + } + if (floor >= 2) + scene->addEntity("Middle Hitbox") + .addComponent(Vector3f(width / 2 - width / 4, 0, height / 2 - height / 4)) + .addComponent( + WAL::Callback(), + &MapGenerator::wallCollided, Vector3f(0.25, 0.25, 0.25),Vector3f(width, 0.75, height / 2 + height / 4)); + } + void MapGenerator::loadMap(int width, int height, MapBlock map, const std::shared_ptr &scene) - { + { + generateHeightCollision(map, width, height, scene); generateWall(width, height, scene); generateFloor(map, width, height, scene); for (int x = 0; x < width + 1; x++) diff --git a/sources/Map/Map.hpp b/sources/Map/Map.hpp index 8fb6da1c..f7eef37c 100644 --- a/sources/Map/Map.hpp +++ b/sources/Map/Map.hpp @@ -31,6 +31,7 @@ namespace BBM class MapGenerator { private: + //! @brief Enum of the block available. enum BlockType { @@ -111,6 +112,25 @@ namespace BBM //! @brief Create upper floor of the map static void createUpperFloor(Vector3f coords, std::shared_ptr scene); + //! @param width Width of the map + //! @param height Height of the map + //! @param scene Scene where the map is instanced + //! @brief Generate the height hitbox of the map + static void generateHeightCollision(MapBlock map, int width, int height, + std::shared_ptr scene); + + //! @param map Map to load with block declared inside + //! @param width Width of the map + //! @param height Height of the map + //! @brief Generate unbreakable block on the map + static MapBlock createClassicUnbreakable(MapBlock map, int width, int height); + + //! @param map Map to load with block declared inside + //! @param width Width of the map + //! @param height Height of the map + //! @brief Generate unbreakable block on map + static MapBlock createLongClassicUnbreakable(MapBlock map, int width, int height); + //! @param map Map to load with block declared inside //! @param width Width of the map //! @param height Height of the map @@ -160,11 +180,20 @@ namespace BBM CollisionComponent::CollidedAxis collidedAxis); static void wallDestroyed(WAL::Entity &entity, WAL::Wal &wal); + static void holeCollide(WAL::Entity &entity, + const WAL::Entity &wall, + CollisionComponent::CollidedAxis collidedAxis); + + static void bumperCollide(WAL::Entity &entity, + const WAL::Entity &wall, + CollisionComponent::CollidedAxis collidedAxis); + + //! @param width Width of the map //! @param height Height of the map //! @brief Generate map of block to be loaded - static MapBlock createMap(int width, int height); + static MapBlock createMap(int width, int height, bool isHeight = false, bool isNotClassic = false); //! @param width Width of the map //! @param height Height of the map @@ -172,6 +201,5 @@ namespace BBM //! @param scene Scene where the map is instanced //! @brief Generate the map static void loadMap(int width, int height, MapBlock map, const std::shared_ptr &scene); - }; } // namespace BBM \ No newline at end of file diff --git a/sources/Runner/GameScene.cpp b/sources/Runner/GameScene.cpp index de8c3ccd..f7f0107e 100644 --- a/sources/Runner/GameScene.cpp +++ b/sources/Runner/GameScene.cpp @@ -2,6 +2,7 @@ #include #include "Runner.hpp" #include +#include #include "Component/Music/MusicComponent.hpp" #include "Component/Sound/SoundComponent.hpp" #include "Component/Controllable/ControllableComponent.hpp" @@ -16,6 +17,10 @@ #include "Component/Shaders/ShaderComponent.hpp" #include "Component/Tag/TagComponent.hpp" #include "Component/Renderer/Drawable3DComponent.hpp" +#include "Component/Button/ButtonComponent.hpp" +#include "Drawables/2D/Text.hpp" +#include "Component/Gravity/GravityComponent.hpp" +#include "Component/BumperTimer/BumperTimerComponent.hpp" #include "Model/Model.hpp" #include "Map/Map.hpp" @@ -47,6 +52,8 @@ namespace BBM .addComponent("assets/player/player.iqm", true) .addComponent() .addComponent() + .addComponent() + .addComponent() // .addComponent("assets/shaders/glsl330/predator.fs") .addComponent>() .addComponent("assets/player/player.iqm", 3) @@ -55,6 +62,7 @@ namespace BBM .addComponent(soundPath) .addComponent("assets/musics/music_battle.ogg") .addComponent() + .addComponent() .addComponent(1, [](WAL::Entity &entity, WAL::Wal &) { auto &animation = entity.getComponent(); animation.setAnimIndex(5); diff --git a/sources/Runner/Runner.cpp b/sources/Runner/Runner.cpp index 98164ecf..6af5e04c 100644 --- a/sources/Runner/Runner.cpp +++ b/sources/Runner/Runner.cpp @@ -30,6 +30,8 @@ #include #include "System/Sound/PlayerSoundManagerSystem.hpp" #include "System/Sound/MenuSoundManagerSystem.hpp" +#include "System/Gravity/GravitySystem.hpp" +#include "System/BumperTimer/BumperTimerSystem.hpp" #include "System/Music/MusicSystem.hpp" #include "System/Lobby/LobbySystem.hpp" #include "Component/Lobby/LobbyComponent.hpp" @@ -80,6 +82,8 @@ namespace BBM .addSystem() .addSystem() .addSystem() + .addSystem() + .addSystem() .addSystem(); } diff --git a/sources/System/BombHolder/BombHolderSystem.hpp b/sources/System/BombHolder/BombHolderSystem.hpp index c7fc11e7..c5631190 100644 --- a/sources/System/BombHolder/BombHolderSystem.hpp +++ b/sources/System/BombHolder/BombHolderSystem.hpp @@ -75,4 +75,4 @@ namespace BBM //! @brief A bomb holder system is not assignable. BombHolderSystem &operator=(const BombHolderSystem &) = delete; }; -} +} \ No newline at end of file diff --git a/sources/System/BumperTimer/BumperTimerSystem.cpp b/sources/System/BumperTimer/BumperTimerSystem.cpp new file mode 100644 index 00000000..36c8b93f --- /dev/null +++ b/sources/System/BumperTimer/BumperTimerSystem.cpp @@ -0,0 +1,25 @@ +// +// Created by Tom Augier on 2021-06-09. +// + +#include "BumperTimerSystem.hpp" + +namespace BBM +{ + BumperTimerSystem::BumperTimerSystem(WAL::Wal &wal) + : System(wal) + {} + + void BumperTimerSystem::onUpdate(WAL::ViewEntity &entity, std::chrono::nanoseconds dtime) + { + auto &bumperTimer = entity.get(); + + if (bumperTimer._isReseting) { + bumperTimer.nextReset -= dtime; + if (bumperTimer.nextReset <= 0ns) { + bumperTimer.nextReset = bumperTimer.resetRate; + bumperTimer._isReseting = false; + } + } + } +} \ No newline at end of file diff --git a/sources/System/BumperTimer/BumperTimerSystem.hpp b/sources/System/BumperTimer/BumperTimerSystem.hpp new file mode 100644 index 00000000..d1bbe2e8 --- /dev/null +++ b/sources/System/BumperTimer/BumperTimerSystem.hpp @@ -0,0 +1,29 @@ +// +// Created by Tom Augier on 2021-06-09. +// + +#pragma once + +#include "Component/Movable/MovableComponent.hpp" +#include "Component/Position/PositionComponent.hpp" +#include "Component/BumperTimer/BumperTimerComponent.hpp" +#include "System/System.hpp" + +namespace BBM +{ + //! @brief A system to handle BumperTimer entities. + class BumperTimerSystem : public WAL::System + { + public: + //! @inherit + void onUpdate(WAL::ViewEntity &entity, std::chrono::nanoseconds dtime) override; + //! @brief A default constructor + explicit BumperTimerSystem(WAL::Wal &wal); + //! @brief A BumperTimer system is copy constructable + BumperTimerSystem(const BumperTimerSystem &) = default; + //! @brief A default destructor + ~BumperTimerSystem() override = default; + //! @brief A system is not assignable. + BumperTimerSystem &operator=(const BumperTimerSystem &) = delete; + }; +} \ No newline at end of file diff --git a/sources/System/Gravity/GravitySystem.cpp b/sources/System/Gravity/GravitySystem.cpp new file mode 100644 index 00000000..a61e4220 --- /dev/null +++ b/sources/System/Gravity/GravitySystem.cpp @@ -0,0 +1,21 @@ +// +// Created by Tom Augier on 2021-06-09. +// + +#include "GravitySystem.hpp" + +namespace BBM +{ + GravitySystem::GravitySystem(WAL::Wal &wal) + : System(wal) + {} + + void GravitySystem::onFixedUpdate(WAL::ViewEntity &entity) + { + auto &movable = entity.get(); + auto &position = entity.get(); + + if (position.getY() > 0) + movable.addForce(Vector3f(0, -0.1, 0)); + } +} \ No newline at end of file diff --git a/sources/System/Gravity/GravitySystem.hpp b/sources/System/Gravity/GravitySystem.hpp new file mode 100644 index 00000000..59963ac7 --- /dev/null +++ b/sources/System/Gravity/GravitySystem.hpp @@ -0,0 +1,30 @@ +// +// Created by Tom Augier on 2021-06-09. +// + +#pragma once + +#include "Component/Movable/MovableComponent.hpp" +#include "Component/Position/PositionComponent.hpp" +#include "Component/Gravity/GravityComponent.hpp" +#include "System/System.hpp" + +namespace BBM +{ + //! @brief A system to handle Gravity entities. + class GravitySystem : public WAL::System + { + public: + //! @inherit + void onFixedUpdate(WAL::ViewEntity &entity) override; + + //! @brief A default constructor + explicit GravitySystem(WAL::Wal &wal); + //! @brief A Gravity system is copy constructable + GravitySystem(const GravitySystem &) = default; + //! @brief A default destructor + ~GravitySystem() override = default; + //! @brief A system is not assignable. + GravitySystem &operator=(const GravitySystem &) = delete; + }; +} \ No newline at end of file diff --git a/sources/System/Lobby/LobbySystem.cpp b/sources/System/Lobby/LobbySystem.cpp index f897fc3c..9c020625 100644 --- a/sources/System/Lobby/LobbySystem.cpp +++ b/sources/System/Lobby/LobbySystem.cpp @@ -160,7 +160,8 @@ namespace BBM continue; auto &player = Runner::createPlayer(*scene); _addController(player, lobby.layout); - player.getComponent().position = Vector3f(mapWidth * (playerCount % 2), 0, + player.getComponent().position = Vector3f(mapWidth * (playerCount % 2), + 0, mapHeight * ((playerCount + 1) % 2)); auto *model = dynamic_cast(player.getComponent().drawable.get()); model->setTextureToMaterial(MAP_DIFFUSE, "assets/player/textures/" + _colors[lobby.color] + ".png");