After implementing a collision detection system (from my last post), I've been trying to find a good way to stop movement after 2 moving entities collide with each other. I've seen multiple people talking about using something like this:
if (entity != collidingEntity && entity->getSprite().getGlobalBounds().intersects(collidingEntity->getSprite().getGlobalBounds()))
{
entity->setPosition(entity->getLastPosition());
} After trying this, the problem still stands that my player can still go through objects. The enemies that collide that follow it stop entirely, and only resume movement in certain circumstances.
I'm using SFML and C++, by the way.