From b7d43fef6aff270c2169c03fed15024f7bafc156 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Mon, 7 Jun 2021 18:01:19 +0200 Subject: [PATCH] starting to look into collisions --- CMakeLists.txt | 18 +++++++++--------- sources/Map/Map.cpp | 2 ++ sources/Runner/Runner.cpp | 14 +++++++------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 966a6d01..8a830ed8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,15 +79,15 @@ target_link_libraries(bomberman PUBLIC wal ray) add_executable(unit_tests EXCLUDE_FROM_ALL - ${SOURCES} - tests/EntityTests.cpp - tests/MainTest.cpp - tests/EngineTests.cpp - tests/CallbackTest.cpp - tests/MoveTests.cpp - tests/ViewTest.cpp - tests/CollisionTest.cpp -) + ${SOURCES} + tests/EntityTests.cpp + tests/MainTest.cpp + tests/EngineTests.cpp + tests/CallbackTest.cpp + tests/MoveTests.cpp + tests/ViewTest.cpp + tests/CollisionTest.cpp + ) target_include_directories(unit_tests PUBLIC sources) target_link_libraries(unit_tests PUBLIC wal ray) diff --git a/sources/Map/Map.cpp b/sources/Map/Map.cpp index c4709164..618725b6 100644 --- a/sources/Map/Map.cpp +++ b/sources/Map/Map.cpp @@ -16,6 +16,8 @@ namespace BBM auto *mov = entity.tryGetComponent(); if (!mov) return; + mov->_velocity = BBM::Vector3f (); + return; auto &pos = entity.getComponent(); const auto &wallPos = wall.getComponent(); auto diff = pos.position + mov->getVelocity() - wallPos.position; diff --git a/sources/Runner/Runner.cpp b/sources/Runner/Runner.cpp index 011ffee3..1be23954 100644 --- a/sources/Runner/Runner.cpp +++ b/sources/Runner/Runner.cpp @@ -72,14 +72,14 @@ namespace BBM scene->addEntity("camera") .addComponent(8, 20, 7) .addComponent(Vector3f(8, 0, 8)); -// scene->addEntity("cube") -// .addComponent(5, 0, 5) -// .addComponent(Vector3f(-5, 0, -5), Vector3f(3, 3, 3), RED) -// .addComponent() -// .addComponent() -// .addComponent(WAL::Callback(), &MapGenerator::wallCollide, 3); + scene->addEntity("cube") + .addComponent(5, 0, 5) + .addComponent(Vector3f(-5, 0, -5), Vector3f(3, 3, 3), RED) + .addComponent() + .addComponent() + .addComponent(WAL::Callback(), &MapGenerator::wallCollide, 3); std::srand(std::time(nullptr)); - MapGenerator::loadMap(16, 16, MapGenerator::createMap(16, 16), scene); + //MapGenerator::loadMap(16, 16, MapGenerator::createMap(16, 16), scene); return scene; }