public string CheckArea(Entity e, Camera c) {
for (int i = (int)e.Loc.X - 2; i < (int)e.Loc.X + 2; i++) {
//Loops through nearby y values
for (int j = (int)e.Loc.Y - 2; j < (int)e.Loc.Y + 2; j++) {
//Checks if the spot is a valid spot to check
if (i > -1 && j > -1 && i < objectMap.GetLength(0) && j < objectMap.GetLength(1)) {
//Checks to see if the object is null
if (objectMap[i, j] != null) {
bool left = false, right = false, top = false, bot = false;
//Checks if there is an object to the left
if ((i - 1) > -1 && objectMap[i - 1, j] != null && objectMap[i - 1, j].collision) {
left = true;
}
//Checks if there is an object to the right
if ((i + 1) < objectMap.GetLength(0) && objectMap[i + 1, j] != null && objectMap[i + 1, j].collision) {
right = true;
}
//Checks if there is an object to the top
if ((j - 1) > -1 && objectMap[i, j - 1] != null && objectMap[i, j - 1].collision) {
top = true;
}
//Checks if there is an object to the bot
if ((j + 1) < objectMap.GetLength(1) && objectMap[i, j + 1] != null && objectMap[i, j + 1].collision) {
bot = true;
}
//Checks to see if the object collides
if (!objectMap[i, j].CheckCollide(e, c, left, right, top, bot).Equals("none")) {
//If the entity is a projectile then set the first index has a hit in it
if (e is Projectile) {
return "hit";
//Else is a character and puts the side with the collsion in the array
} else {
return objectMap[i, j].CheckCollide(e, c, left, right, top, bot);
}
}
}
}
}
}
//Return the sides
return "none";
}