This is my movement function and collision checker
int Engine::isCollision(int x, int y, int z)
{
if (collision_map[x][y][z] == 0)
{
return 0;
}
if (collision_map[x][y][z] == 1)
{
return 1;
}
}
int Inputs::input_handler(int x, int y, int z, int cpf)
{
constexpr auto KEY_UP = 72;
constexpr auto KEY_DOWN = 80;
constexpr auto KEY_LEFT = 75;
constexpr auto KEY_RIGHT = 77;
constexpr auto ESC = 27;
int checkx = x;
int checky = y;
int checkz = z;
char input_ = _getch();
if (input_ == KEY_UP) {
checky -= 1;
if (isCollision(checkx, checky, checkz) == 1)
{
y -= 0;
std::cout << "I can't do this";
}
if (isCollision(checkx, checky, checkz) == 0)
{
y -= 1;
}
}
//other key inputs removed for brevity
}