Undo hitbox gestion

This commit is contained in:
Ulysse Cura 2024-09-08 14:05:19 +02:00
parent 4c08a56057
commit 8f39b26b9d
2 changed files with 2 additions and 53 deletions

34
.gitignore vendored
View File

@ -1,34 +1,4 @@
# ---> C++
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# Executable
2D_Engine

View File

@ -161,8 +161,6 @@ class PlayerSystem : public Component {
if(i == 0) m_transform->velocity.x = 0;
if(i == 1) m_transform->velocity.y = 0;
m_resolveCollisions(entityHitboxR);
break;
}
}
@ -246,25 +244,6 @@ class PlayerSystem : public Component {
}
}
void m_resolveCollisions(SDL_Rect &entityHitboxR)
{
SDL_Rect intersectR;
if (SDL_IntersectRect(&m_hitbox->hitboxR, &entityHitboxR, &intersectR))
{
float overlapY = static_cast<float>(intersectR.h);
if(m_transform->position.y + m_transform->dimension.y * m_transform->scale < static_cast<float>(entityHitboxR.y))
{
m_transform->position.y -= overlapY;
}
else
{
m_transform->position.y += overlapY;
}
}
}
bool m_isInRange(const SDL_Rect &entityR)
{
SDL_Rect intersectR {entityR};