0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 23:33:41 +00:00
SDL_Minigame/include/ColliderComponent.h
2024-01-28 16:49:08 +01:00

29 lines
762 B
C++

#pragma once
#include <SDL.h>
#include "Component.h"
#include "Vector2D.h"
class TransformComponent;
class ColliderComponent : public Component
{
public:
SDL_Rect collider;
const char* tag;
TransformComponent* transform;
bool hasCollision; //added for removing collision of destroyed projectiles
float hitboxScale; //adds a seperate variable for the scale of the hitbox (not the sprite) so each sprite can have a different hitbox size if needed
bool isProjectile = false;
ColliderComponent(const char* tag);
ColliderComponent(const char* tag, float hitboxScale);
void init() override;
void update() override;
void removeCollision();
void handleCollision(Vector2D& characterPos, SDL_Rect& characterCollider, SDL_Rect& componentCollider);
};