-
Notifications
You must be signed in to change notification settings - Fork 1
/
victim.h
48 lines (35 loc) · 914 Bytes
/
victim.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
#ifndef _VICTIM_H_
#define _VICTIM_H_
#include "coords.h"
#include "animation.h"
class Victim
{
public:
enum Plan { PLAN_NOTHING, PLAN_WANDER, PLAN_CHASE_FOOD }; // Current plan of action (AI)
Victim(PixelCoords pos);
void nextAnimFrame();
void draw();
void feed(int foodValue);
bool canMove();
void doMove();
void explode();
Victim split();
PixelCoords position;
bool isDying;
bool isDead;
Plan plan;
PixelCoords target; // This is where we want to go
int splitCountdown; // How many food items we need to consume until split
int walkSteps; // How many steps are we walking to this target
int splitAgain; // Ticks until can split again
private:
static const float MAX_SPEED = 2.5;
static const float BASE_SPEED = 1.0;
static const float INCREASE_SPEED = 0.1;
static const int FOOD_TO_SPLIT = 3;
static const int SPLIT_AGAIN_TICKS = 10;
float speed;
Animation walkAnim;
Animation deathAnim;
};
#endif