summary refs log tree commit diff stats
path: root/src/entity.h
blob: 33872196d10d37f53bd6f312cf3c97fa86e18d83 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef ENTITY_H_0D6CB29A
#define ENTITY_H_0D6CB29A

#include <set>
#include <vector>
#include "vector.h"
#include "enums.h"
#include "direction.h"

class Entity;

using id_type = std::vector<Entity>::size_type;

class Entity {
public:

  Entity(id_type id) : id(id)
  {
  }

  id_type id;

  // Transform
  vec2s pos;
  vec2s size;

  // Grid placement
  vec2s gridPos;
  Layer layer = Layer::object;

  // Movement
  Direction shouldMoveTo = Direction::none;
  bool moving = false;
  vec2s destPos;
  double movementTween = 0.0;
  double speed = 0.0; // Tiles per second
  Direction moveDir = Direction::none;

  // Player
  bool controllable = false;

  // Collision
  ColliderType colliderType = ColliderType::other;
  std::set<ColliderType> canBePushedBy;

  // Temp
  int colorVal = 25;

  bool scheduled = false;

  // Track
  bool isTrack = false;
  Direction trackDir1 = Direction::none;
  Direction trackDir2 = Direction::none;

};

#endif /* end of include guard: ENTITY_H_0D6CB29A */