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
11class ColliderComponent : public Component
12{
13public:
14 SDL_Rect& getCollider() { return collider; }
15 const char* getTag() const { return tag; }
16 bool hasCollision() const { return collision; }
17
20 ColliderComponent(const char* tag);
21
25 ColliderComponent(const char* tag, float hitboxScale);
26
27 void init() override;
28 void update(uint_fast16_t diffTime) override;
30 void removeCollision();
31private:
32 SDL_Rect collider;
33 const char* tag;
34 TransformComponent* transform;
35 bool collision; //added for removing collision of destroyed projectiles
36 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
37};
SDL_Rect & getCollider()
Definition ColliderComponent.h:14
const char * getTag() const
Definition ColliderComponent.h:15
void removeCollision()
Removes the collision of an entity.
Definition ColliderComponent.cpp:43
bool hasCollision() const
Definition ColliderComponent.h:16
ColliderComponent(const char *tag)
Constructor for ColliderComponent.
Definition ColliderComponent.cpp:9
The transform component is responsible for the position, direction and size of an entity....
Definition TransformComponent.h:10