SDL SPOOKY PLATFORMER ENGINE  0.2.0
An implementation of a platformer using sdl, implemented using an entity component system and efficient collision management.
EnemyAIComponent.hpp
Go to the documentation of this file.
1 #ifndef ENEMYAI_H
2 #define ENEMYAI_H
3 
4 #include "Component.hpp"
5 #include "TransformComponent.hpp"
6 #include "PhysicsComponent.hpp"
7 #include "TinyMath.hpp"
8 #include "SDL2/SDL.h"
9 #include "TickTimer.hpp"
10 #include "GameManager.hpp"
11 
12 
13 #define DRIFT_RATE 1
14 #define MAX_SPEED 12
15 #define TELEPORT_DISTANCE 750
16 #define TELEPORT_MIN_DELAY_MS 2500
17 
18 class EnemyAIComponent : public Component{
19  public:
20 
21  EnemyAIComponent(const GameObject* target);
23 
24  void Update(float deltaTime);
25  private:
26  void Teleport();
27 
28  TransformComponent* targetTransform;
29  TransformComponent* transform;
30  PhysicsComponent* physics;
31  Vector3D accel;
32  TickTimer teleportTimer;
33  float teleportMs;
34  bool frozen;
35  // If the ghost is frozen, use this to include the time it was frozen for
36  int teleportMsMod;
37  Vector3D preserveVelocity;
38 };
39 
40 #endif
Definition: TickTimer.hpp:7
Definition: TinyMath.hpp:15
Definition: PhysicsComponent.hpp:8
Definition: TransformComponent.hpp:6
void Update(float deltaTime)
Update this component according to the deltaTime.
Definition: EnemyAIComponent.cpp:23
~EnemyAIComponent()
Definition: EnemyAIComponent.cpp:11
Definition: GameObject.hpp:12
EnemyAIComponent(const GameObject *target)
Definition: EnemyAIComponent.cpp:6
Definition: Component.hpp:13
Definition: EnemyAIComponent.hpp:18