dungeon/src/Entity.h

43 lines
994 B
C
Raw Normal View History

2017-09-26 15:49:11 +02:00
//
// Created by Adrian on 2017-09-25.
//
#ifndef DUNGEON_ENTITY_H
#define DUNGEON_ENTITY_H
#include "vec2i.h"
#include "Color.h"
2017-09-26 15:49:11 +02:00
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;
2017-09-26 15:49:11 +02:00
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; };
2017-09-26 15:49:11 +02:00
virtual EntityTypes entity_type() { return ENTITY_BASE; };
};
#endif //DUNGEON_ENTITY_H