123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #ifndef ENTITY_H
- #define ENTITY_H
-
- #include "olcPGEX_Graphics2D.h"
- #include "olcPixelGameEngine.h"
- #include <cmath>
-
- namespace pabloader {
- class Debuggers;
-
- class Entity {
- protected:
- Debuggers* game;
- olc::Sprite* sprite;
- olc::GFX2D::Transform2D transform;
- float x, y;
- float xv = 0, yv = 0;
- int w, h;
-
- uint8_t tileX = 0;
- uint8_t tileY = 0;
-
- uint8_t tileCols = 4;
- uint8_t tileRows = 4;
-
- float rotation = 0;
- float rotationSpeed = 0;
- #ifdef _DEBUG
- olc::Pixel DEBUG_COLOR;
- #endif
-
- public:
- Entity(Debuggers* game, olc::Sprite* s);
- virtual ~Entity(){};
-
- virtual void Update(float dt);
- virtual void Draw();
-
- float GetX() { return x; }
- float GetY() { return y; }
-
- bool Collides(Entity* entity);
- float Dist(Entity* entity) { return std::hypot(x - entity->x, y - entity->y); }
-
- virtual bool IsActive();
- virtual void ResetPosition();
- virtual void Kill();
- };
- }
-
- #endif
|