Worked on Colliders

This commit is contained in:
2021-08-25 17:11:46 -04:00
parent 1e5beb5b88
commit 165052a617
5 changed files with 40 additions and 7 deletions

View File

@ -36,21 +36,23 @@ public:
tag = t;
}
ColliderComponent(std::string t, int xpos, int ypos, int size, int scale)
ColliderComponent(std::string t, int xpos, int ypos, int size, int scale, std::string texture)
{
tag = t;
collider.x = xpos;
collider.y = ypos;
collider.w = collider.h = size*scale;
setTex(texture);
}
ColliderComponent(std::string t, int width, int height, bool hasOffset, int oX, int oY)
ColliderComponent(std::string t, int width, int height, bool hasOffset, int oX, int oY, std::string texture)
{
tag = t;
collider.w = width;
collider.h = height;
offsetX = oX;
offsetY = oY;
setTex(texture);
}
void init() override
@ -89,6 +91,11 @@ public:
TextureManager::Draw(tex, srcR,destR,SDL_FLIP_NONE);
}
}
void setTex(std::string id)
{
tex = Game::assets->GetTexture(id);
}
};