VEGO-Engine  0.1
Loading...
Searching...
No Matches
ColliderComponent.h
1#pragma once
2
3#include <SDL3/SDL.h>
4
5#include "Component.h"
6#include "Vector2D.h"
7
9
10class ColliderComponent : public Component
11{
12public:
13 SDL_Rect collider;
14 const char* tag;
15 TransformComponent* transform;
16 bool hasCollision; //added for removing collision of destroyed projectiles
17 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
18
19 bool isProjectile = false;
20
21 ColliderComponent(const char* tag);
22 ColliderComponent(const char* tag, float hitboxScale);
23
24 void init() override;
25 void update(uint_fast16_t diffTime) override;
26 void removeCollision();
27
28 void handleCollision(Vector2D& characterPos, SDL_Rect& characterCollider, SDL_Rect& componentCollider);
29};
Definition Component.h:8
Definition TransformComponent.h:9
Definition Vector2D.h:7