Worked on Colliders
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
@ -16,7 +16,7 @@
|
||||
class KeyboardController : public Component
|
||||
{
|
||||
public:
|
||||
// bool keyIsAlreadyPressed[];
|
||||
|
||||
TransformComponent *transform;
|
||||
SpriteComponent *sprite;
|
||||
|
||||
|
Reference in New Issue
Block a user