forked from ComputerGeek01/Random
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBASE.cpp
102 lines (81 loc) · 1.75 KB
/
BASE.cpp
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include "Building.hpp"
sf::Sprite* BASE::draw()
{
if(Selected)
{
Sprite2.SetPosition(Pos);
return &Sprite2;
}
Sprite.SetPosition(Pos);
return &Sprite;
}
bool BASE::Hit(BASE* Obj)
{
if(Test(Pos, Obj->Pos, RB, Obj->RB))
{
return true;
}
return false;
}
bool BASE::Test(sf::Vector2f A, sf::Vector2f B, sf::Vector2f RBA, sf::Vector2f RBB)
{
if((A.x > B.x) && (A.x < RBB.x) && (A.y > B.y) && (A.y < RBB.y))
{
/* if(A.x > B.x)
{
std::cout << " A.x Greater Then B.x\n";
}
if(A.x < RBB.x)
{
std::cout << " A.x Less Then RBB.x\n";
}
if(A.y > B.y)
{
std::cout << " A.y Greater Then B.y\n";
}
if(A.y < RBB.y)
{
std::cout << " A.y Less Then RBB.y\n";
} */
return true;
}
if((RBA.x > B.x) && (RBA.x < RBB.x) && (RBA.y > B.y) && (RBA.y < RBB.y))
{
/* if(RBA.x > B.x)
{
std::cout << " RBA.x Greter Then B.x\n";
}
if(RBA.x < RBB.x)
{
std::cout << " RBA.x Less Then RBB.x\n";
}
if(RBA.y > B.y)
{
std::cout << " RBA.y Greater Then B.y\n";
}
if(RBA.y < RBB.y)
{
std::cout << " RBA.y Less Then RBB.y\n";
} */
return true;
}
return false;
}
std::string BASE::GetData()
{
return "Hello";
}
std::string BASE::TYPE()
{
switch(Type)
{
case HUMAN:
return " Human ";
case ZOMBIE:
return " Zombie ";
case TER:
return " Building ";
default:
return " NULL ";
}
}