aboutsummaryrefslogtreecommitdiffstats
path: root/src/entity.cpp
blob: 3b21557d297f3c299215d8038de86d1e7ef79b78 (plain)
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
/*********************************/
/*   THRESHOLD        (  //      */
/*   entity            ( )/      */
/*   by salade         )(/       */
/*  ________________  ( /)       */
/* ()__)____________)))))   :^}  */
/*********************************/

#include "entity.hpp"

Entity::Entity(void) : hp(1)
{
    auto dir = GetRandomValue(0, 3);

    switch (dir)
    {
        case (0):
        {
            posX = GetRandomValue((SCREENWIDTH / 2) - 30, (SCREENWIDTH / 2) + 30);
            posY = GetRandomValue(0, 40);
            break;
        }
        case (1):
        {
            posX = GetRandomValue(SCREENWIDTH - 20, SCREENWIDTH + 20);
            posY = GetRandomValue((SCREENHEIGHT / 2) - 30, (SCREENHEIGHT / 2) + 30);
            break;
        }
        case (2):
        {
            posX = GetRandomValue((SCREENWIDTH / 2) - 30, (SCREENWIDTH / 2) + 30);
            posY = GetRandomValue(SCREENHEIGHT - 20, SCREENHEIGHT + 20);
            break;
        }
        case (3):
        {
            posX = GetRandomValue(SCREENWIDTH - 20, SCREENWIDTH + 20);
            posY = GetRandomValue((SCREENHEIGHT / 2), (SCREENHEIGHT / 2) + 10);
            break;
        }
    }

    direction = (Vector2){0.02f, 0.02f};
    radius = 10; // default radius. this is changed later
    threshold = false;
}

Entity::~Entity() {}