-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsystem_ai.h
53 lines (44 loc) · 961 Bytes
/
system_ai.h
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
#ifndef SYSTEM_AI_H
#define SYSTEM_AI_H
#include <time.h>
#include "component_motion.h"
#include "component_sprite.h"
#include "system.h"
class SystemAI : public System
{
public:
SystemAI() : System(), initialized(false), state(-1), pressed_left(false), pressed_right(false), pressed_up(false)
{
srand((unsigned int)time(NULL));
};
~SystemAI()
{
};
virtual void Update();
protected:
virtual Type GetType()
{
return System::TYPE_AI;
};
private:
bool Initialize();
void UpdateKeys();
void UpdateMovement();
void MoveLeft();
void MoveRight();
void Jump();
void Stop();
float GetRandom();
double XBallBelow(double y_target);
bool initialized;
int state;
bool pressed_left;
bool pressed_right;
bool pressed_up;
ComponentSprite* cspr_player_1;
ComponentSprite* cspr_player_2;
ComponentMotion* cmot_player_2;
ComponentSprite* cspr_ball;
ComponentMotion* cmot_ball;
};
#endif