forked from annatruong04/project_oop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlocked.cpp
39 lines (33 loc) · 832 Bytes
/
Blocked.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
#include "Blocked.h"
bool Blocked::blockDown(Animal *animal){
int i = animal->getPoy()/32;
int j = animal->getPox()/32;
if (mapCreation::id_objects[i+1][j] == 0){
return true;
}
return false;
}
bool Blocked::blockUp(Animal *animal){
int i = animal->getPoy()/32;
int j = animal->getPox()/32;
if (mapCreation::id_objects[i-1][j] == 0){
return true;
}
return false;
}
bool Blocked::blockRight(Animal *animal){
int i = animal->getPoy()/32;
int j = animal->getPox()/32;
if (mapCreation::id_objects[i][j+1] == 0) {
return true;
}
return false;
}
bool Blocked::blockLeft(Animal *animal){
int i = animal->getPoy()/32;
int j = animal->getPox()/32;
if (mapCreation::id_objects[i][j-1] == 0){
return true;
}
return false;
};