mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-02 10:15:32 +00:00
Collisions are still broke
This commit is contained in:
@@ -84,7 +84,7 @@ namespace WAL
|
||||
//! @brief True if the engine should close after the end of the current tick.
|
||||
bool shouldClose = false;
|
||||
//! @brief The time between each fixed update.
|
||||
static constexpr std::chrono::nanoseconds timestep = std::chrono::milliseconds(16);
|
||||
static constexpr std::chrono::nanoseconds timestep = std::chrono::milliseconds(32);
|
||||
|
||||
//! @brief Create a new system in place.
|
||||
//! @return The wal instance used to call this function is returned. This allow method chaining.
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ namespace BBM
|
||||
auto &pos = entity.getComponent<PositionComponent>();
|
||||
const auto &wallPos = wall.getComponent<PositionComponent>();
|
||||
auto diff = pos.position + mov->getVelocity() - wallPos.position;
|
||||
std::cout << diff << std::endl;
|
||||
// mov->_velocity = Vector3f();
|
||||
if (diff.x <= 0 && mov->_velocity.x < 0)
|
||||
mov->_velocity.x = 0;
|
||||
if (diff.x >= 0 && mov->_velocity.x > 0)
|
||||
|
||||
@@ -72,6 +72,12 @@ namespace BBM
|
||||
scene->addEntity("camera")
|
||||
.addComponent<PositionComponent>(8, 20, 7)
|
||||
.addComponent<CameraComponent>(Vector3f(8, 0, 8));
|
||||
// scene->addEntity("cube")
|
||||
// .addComponent<PositionComponent>(5, 0, 5)
|
||||
// .addComponent<Drawable3DComponent, RAY3D::Cube>(Vector3f(-5, 0, -5), Vector3f(3, 3, 3), RED)
|
||||
// .addComponent<ControllableComponent>()
|
||||
// .addComponent<KeyboardComponent>()
|
||||
// .addComponent<CollisionComponent>(WAL::Callback<WAL::Entity &, const WAL::Entity &>(), &MapGenerator::wallCollide, 3);
|
||||
std::srand(std::time(nullptr));
|
||||
MapGenerator::loadMap(16, 16, MapGenerator::createMap(16, 16), scene);
|
||||
return scene;
|
||||
|
||||
Reference in New Issue
Block a user