Undo hitbox gestion
This commit is contained in:
parent
4c08a56057
commit
8f39b26b9d
|
@ -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
|
|
@ -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};
|
||||
|
|
Loading…
Reference in New Issue