12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #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;
- olc::vf2d pos;
- olc::vf2d vel;
- olc::vi2d size;
-
- olc::v2d_generic<uint8_t> tile{ 0, 0 };
- olc::v2d_generic<uint8_t> tileDim{ 4, 4 };
-
- float rotation = 0;
- float rotationSpeed = 0;
- bool alive = true;
- #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 pos.x; }
- float GetY() { return pos.y; }
-
- bool IsInScreen();
-
- bool Collides(Entity* entity);
- float Dist(Entity* entity) { return (pos - entity->pos).mag(); }
-
- virtual bool IsActive();
- virtual bool IsAlive();
- virtual void ResetPosition();
- virtual void Kill();
- };
- }
-
- #endif
|