dungeon/src/Entity.h
Adrian Hedqvist ec131d8bda Too much stuff
* Implemented lua using kaguya, only for config files for now
* Moved color struct to its own header
* statically link glew instead of including the source in the project
* Other stuff that I don't remember
2017-10-18 12:25:25 +02:00

43 lines
994 B
C++

//
// Created by Adrian on 2017-09-25.
//
#ifndef DUNGEON_ENTITY_H
#define DUNGEON_ENTITY_H
#include "vec2i.h"
#include "Color.h"
class Tilemap;
enum EntityTypes {
ENTITY_BASE, // All entities are objects that can be placed on the map and can be interacted with
ENTITY_ACTOR, // Actors are characters with AI or controlled by the player
ENTITY_ITEM, // Items can be picked up
};
class Entity {
vec2i position;
Tilemap* map;
protected:
unsigned int sprite_id;
Color sprite_color;
bool collision;
public:
Entity(Tilemap* map, vec2i pos);
Tilemap* get_map();
vec2i get_position();
bool has_collision();
bool move(int dx, int dy); // returns false if movement failed
bool move(vec2i dpos);
void set_position(vec2i pos);
unsigned int get_sprite_id() { return sprite_id; };
Color get_sprite_color() { return sprite_color; };
virtual EntityTypes entity_type() { return ENTITY_BASE; };
};
#endif //DUNGEON_ENTITY_H