//Interacting with an object in all 4 directions from player public void Interact(int x, int y, Dungeon dung, Player creature) { for (int i = -1; i < 2; i += 2) { if (dung.GiveInteraction(x + i, y) == Interaction.ClosedChest) { creature.NewItem(dung.GiveItem(x + i, y)); } else if (dung.GiveInteraction(x + i, y) == Interaction.ClosedDoor || dung.GiveInteraction(x + i, y) == Interaction.OpenedDoor) { dung.OpenInteraction(x + i, y); } } for (int j = -1; j < 2; j = j + 2) { if (dung.GiveInteraction(x, y + j) == Interaction.ClosedChest) { creature.NewItem(dung.GiveItem(x, y + j)); } else if (dung.GiveInteraction(x, y + j) == Interaction.ClosedDoor || dung.GiveInteraction(x, y + j) == Interaction.OpenedDoor) { dung.OpenInteraction(x, y + j); } } }